@@ -452,7 +452,11 @@ pub(super) fn draw_messages(
452452 . y
453453 . saturating_add ( prompt_preview_lines)
454454 . saturating_add ( line as u16 ) ,
455- width : text_render_area. width ,
455+ width : if swarm_beside_pinned_todos ( app, text_render_area. width ) {
456+ text_render_area. width / 2
457+ } else {
458+ text_render_area. width
459+ } ,
456460 height : 1 ,
457461 }
458462 } ) ) ;
@@ -1446,20 +1450,62 @@ fn windowed_min(widths: &[u16], window: usize) -> Vec<u16> {
14461450 out
14471451}
14481452
1449- /// Lines for the pinned todo band. Background tasks render in the
1450- /// `background` info widget, not here.
1453+ /// Whether the pinned band has room for a separate swarm column.
1454+ pub ( crate ) fn swarm_beside_pinned_todos ( app : & dyn TuiState , width : u16 ) -> bool {
1455+ width >= 120
1456+ && crate :: config:: config ( ) . display . pin_todos
1457+ && app. pinned_todos_payload ( ) . is_some ( )
1458+ && app. inline_swarm_gallery_active ( )
1459+ && !app. inline_swarm_members ( ) . is_empty ( )
1460+ && !pinned_todo_band_lines_for_payload (
1461+ app. pinned_todos_payload ( ) ,
1462+ app. pinned_todos_expanded ( ) ,
1463+ app. diff_mode ( ) ,
1464+ width / 2 ,
1465+ 3 ,
1466+ )
1467+ . 0
1468+ . is_empty ( )
1469+ }
1470+
14511471pub ( crate ) fn pinned_todo_band_lines (
14521472 app : & dyn TuiState ,
14531473 width : u16 ,
14541474 viewport_height : u16 ,
14551475) -> ( Vec < Line < ' static > > , Option < usize > ) {
1456- pinned_todo_band_lines_for_payload (
1476+ let beside = swarm_beside_pinned_todos ( app, width) ;
1477+ let todo_width = if beside { width / 2 } else { width } ;
1478+ let ( mut lines, more) = pinned_todo_band_lines_for_payload (
14571479 app. pinned_todos_payload ( ) ,
14581480 app. pinned_todos_expanded ( ) ,
14591481 app. diff_mode ( ) ,
1460- width ,
1482+ todo_width ,
14611483 viewport_height,
1462- )
1484+ ) ;
1485+ if beside && !lines. is_empty ( ) {
1486+ let right_width = width. saturating_sub ( todo_width + 2 ) as usize ;
1487+ let members = app. inline_swarm_members ( ) ;
1488+ let swarm = super :: info_widget:: swarm_gallery:: render_swarm_strip_lines (
1489+ & members,
1490+ app. swarm_panel_selected ( ) ,
1491+ app. swarm_panel_focused ( ) ,
1492+ & crate :: tui:: keybind:: swarm_panel_focus_key_label ( ) ,
1493+ ( app. animation_elapsed ( ) * jcode_tui_render:: swarm_gallery:: STRIP_SPINNER_FPS ) as usize ,
1494+ right_width,
1495+ ( ( viewport_height as usize ) / 3 ) . clamp ( 3 , 16 ) ,
1496+ ) ;
1497+ lines. resize_with ( lines. len ( ) . max ( swarm. len ( ) ) , || Line :: from ( "" ) ) ;
1498+ for ( index, line) in lines. iter_mut ( ) . enumerate ( ) {
1499+ * line = super :: truncate_line_with_ellipsis_to_width ( line, todo_width as usize ) ;
1500+ if let Some ( right) = swarm. get ( index) {
1501+ line. spans . push ( Span :: raw (
1502+ " " . repeat ( ( todo_width as usize ) . saturating_sub ( line. width ( ) ) + 2 ) ,
1503+ ) ) ;
1504+ line. spans . extend ( right. spans . clone ( ) ) ;
1505+ }
1506+ }
1507+ }
1508+ ( lines, more)
14631509}
14641510
14651511/// Pinned todo band for an arbitrary todo payload. Shared by the live chat
0 commit comments