@@ -2793,16 +2793,6 @@ pub(crate) fn render_background_task_message(
27932793 if is_swarm && !parsed. status . starts_with ( '✗' ) {
27942794 return render_compact_swarm_background_completion ( & parsed, width) ;
27952795 }
2796- if parsed. status . starts_with ( '✗' ) {
2797- let muted = Style :: default ( ) . fg ( dim_color ( ) ) ;
2798- let failure = Style :: default ( ) . fg ( rgb ( 220 , 100 , 100 ) ) ;
2799- let block_width = if centered {
2800- super :: centered_content_block_width ( width, 96 )
2801- } else {
2802- width as usize
2803- } ;
2804- let row_width = block_width. saturating_sub ( 1 ) ;
2805- let timing = msg
28062796 if parsed. status . starts_with ( '✓' ) {
28072797 let muted = Style :: default ( ) . fg ( dim_color ( ) ) ;
28082798 let block_width = if centered {
@@ -2835,6 +2825,16 @@ pub(crate) fn render_background_task_message(
28352825 }
28362826 return lines;
28372827 }
2828+ if parsed. status . starts_with ( '✗' ) {
2829+ let muted = Style :: default ( ) . fg ( dim_color ( ) ) ;
2830+ let failure = Style :: default ( ) . fg ( rgb ( 220 , 100 , 100 ) ) ;
2831+ let block_width = if centered {
2832+ super :: centered_content_block_width ( width, 96 )
2833+ } else {
2834+ width as usize
2835+ } ;
2836+ let row_width = block_width. saturating_sub ( 1 ) ;
2837+ let timing = msg
28382838 . content
28392839 . lines ( )
28402840 . find_map ( |line| {
@@ -4115,6 +4115,18 @@ fn inline_diff_header(
41154115 }
41164116 let mut header = Line :: from ( header) ;
41174117 if let Some ( path) = file_path {
4118+ let path_width = width. saturating_sub ( header. width ( ) . saturating_add ( 3 ) ) ;
4119+ if path_width > 0 {
4120+ header. spans . push ( Span :: styled (
4121+ format ! ( " · {}" , tools_ui:: truncate_path_display( path, path_width) ) ,
4122+ dim,
4123+ ) ) ;
4124+ }
4125+ }
4126+ super :: truncate_line_with_ellipsis_to_width ( & header, width)
4127+ . alignment ( ratatui:: layout:: Alignment :: Left )
4128+ }
4129+
41184130/// Keep expanded source lines inside their frame. Wrap the styled source, not
41194131/// the gutter, so continuation rows cannot masquerade as another changed line.
41204132fn expanded_diff_row (
@@ -4188,18 +4200,6 @@ fn expanded_diff_row(
41884200 rows
41894201}
41904202
4191- let path_width = width. saturating_sub ( header. width ( ) . saturating_add ( 3 ) ) ;
4192- if path_width > 0 {
4193- header. spans . push ( Span :: styled (
4194- format ! ( " · {}" , tools_ui:: truncate_path_display( path, path_width) ) ,
4195- dim,
4196- ) ) ;
4197- }
4198- }
4199- super :: truncate_line_with_ellipsis_to_width ( & header, width)
4200- . alignment ( ratatui:: layout:: Alignment :: Left )
4201- }
4202-
42034203fn render_tool_failure_reason ( content : & str , width : usize , indent : usize ) -> Line < ' static > {
42044204 let clean = strip_ansi_escape_sequences ( content) ;
42054205 let summary = tools_ui:: parse_tool_failure ( & clean)
@@ -4732,11 +4732,6 @@ pub(crate) fn render_tool_message(
47324732 } ) ;
47334733 const MAX_DIFF_LINES : usize = MAX_INLINE_DIFF_LINES ;
47344734 let total_changes = change_lines. len ( ) ;
4735- let number_width = change_lines
4736- . iter ( )
4737- . map ( |line| line. prefix . trim ( ) . trim_end_matches ( [ '+' , '-' ] ) . len ( ) )
4738- . max ( )
4739- . unwrap_or ( 0 ) ;
47404735 let additions = change_lines
47414736 . iter ( )
47424737 . filter ( |line| line. kind == DiffLineKind :: Add )
@@ -4762,15 +4757,6 @@ pub(crate) fn render_tool_message(
47624757 |line : & ParsedDiffLine | line. file_path . clone ( ) . or_else ( || file_path_for_ext. clone ( ) ) ;
47634758 let first_file_path = display_lines. first ( ) . and_then ( |line| diff_file_path ( line) ) ;
47644759 lines. push ( inline_diff_header (
4765- if full_inline {
4766- let file_ext = current_file_path
4767- . as_deref ( )
4768- . and_then ( |p| std:: path:: Path :: new ( p) . extension ( ) )
4769- . and_then ( |e| e. to_str ( ) ) ;
4770- lines. extend ( expanded_diff_row ( line, file_ext, number_width, row_width) ) ;
4771- continue ;
4772- }
4773-
47744760 "╭─" ,
47754761 Some ( ( additions, deletions) ) ,
47764762 first_file_path. as_deref ( ) ,
@@ -4779,6 +4765,11 @@ pub(crate) fn render_tool_message(
47794765
47804766 let mut shown_truncation = false ;
47814767 let mut previous_file_path = first_file_path;
4768+ let number_width = change_lines
4769+ . iter ( )
4770+ . map ( |line| line. prefix . trim ( ) . trim_end_matches ( [ '+' , '-' ] ) . len ( ) )
4771+ . max ( )
4772+ . unwrap_or ( 0 ) ;
47824773
47834774 for ( i, line) in display_lines. iter ( ) . enumerate ( ) {
47844775 if truncated && !shown_truncation && i >= half_point {
@@ -4804,6 +4795,15 @@ pub(crate) fn render_tool_message(
48044795 }
48054796 previous_file_path = current_file_path. clone ( ) ;
48064797
4798+ if full_inline {
4799+ let file_ext = current_file_path
4800+ . as_deref ( )
4801+ . and_then ( |p| std:: path:: Path :: new ( p) . extension ( ) )
4802+ . and_then ( |e| e. to_str ( ) ) ;
4803+ lines. extend ( expanded_diff_row ( line, file_ext, number_width, row_width) ) ;
4804+ continue ;
4805+ }
4806+
48074807 let base_color = if line. kind == DiffLineKind :: Add {
48084808 diff_add_color ( )
48094809 } else {
0 commit comments