From ecaa77e4991a147c4ea77a5cf7ef8702a03081e8 Mon Sep 17 00:00:00 2001 From: Roy Han Date: Fri, 27 Feb 2026 10:27:22 -0800 Subject: [PATCH] reformat line width check --- codex-rs/tui/src/chatwidget.rs | 2 +- codex-rs/tui/src/history_cell.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index 0a32e8be7d..d0edd2fcad 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -3940,7 +3940,7 @@ impl ChatWidget { } fn add_boxed_history(&mut self, cell: Box) { - if !cell.display_lines(u16::MAX).is_empty() { + if cell.has_visible_display_lines() { // Only break exec grouping if the cell renders visible lines. self.flush_active_cell(); self.needs_final_message_separator = true; diff --git a/codex-rs/tui/src/history_cell.rs b/codex-rs/tui/src/history_cell.rs index b547de97c8..c46fc60232 100644 --- a/codex-rs/tui/src/history_cell.rs +++ b/codex-rs/tui/src/history_cell.rs @@ -96,6 +96,11 @@ pub(crate) trait HistoryCell: std::fmt::Debug + Send + Sync + Any { /// Returns the logical lines for the main chat viewport. fn display_lines(&self, width: u16) -> Vec>; + /// Returns whether this cell renders any visible display lines when width is unconstrained. + fn has_visible_display_lines(&self) -> bool { + !self.display_lines(u16::MAX).is_empty() + } + /// Returns the number of viewport rows needed to render this cell. /// /// The default delegates to `Paragraph::line_count` with @@ -1047,6 +1052,7 @@ fn session_info_body_parts( let mut parts: Vec> = Vec::new(); if is_first_event { + // Help lines below the header (new copy and list) let help_lines: Vec> = vec![ " To get started, describe a task or try one of these commands:" .dim() @@ -1078,6 +1084,7 @@ fn session_info_body_parts( " - review any changes and find issues".dim(), ]), ]; + parts.push(Box::new(PlainHistoryCell { lines: help_lines })); } else { if config.show_tooltips