Lightweight coding agent that runs in your terminal
Rust
fix(tui): avoid doubled blank rows while streaming (#26636)
Felipe Coury841f057f2d26
diff --git a/codex-rs/tui/src/history_cell/messages.rs b/codex-rs/tui/src/history_cell/messages.rsindex ed899f3b2e..787f999cf1 100644--- a/codex-rs/tui/src/history_cell/messages.rs+++ b/codex-rs/tui/src/history_cell/messages.rs@@ -423,7 +423,7 @@ impl HistoryCell for StreamingAgentTailCell {fn display_hyperlink_lines(&self, _width: u16) -> Vec<HyperlinkLine> {// Tail lines are already rendered at the controller's current stream width.// Re-wrapping them here can split table borders and produce malformed in-flight rows.- prefix_hyperlink_lines(+ let mut lines = prefix_hyperlink_lines(self.lines.clone(),if self.is_first_line {"• ".dim()@@ -431,7 +431,19 @@ impl HistoryCell for StreamingAgentTailCell {" ".into()}," ".into(),- )+ );+ for line in &mut lines {+ if line+ .line+ .spans+ .iter()+ .all(|span| span.content.chars().all(char::is_whitespace))+ {+ line.line = Line::default().style(line.line.style);+ line.hyperlinks.clear();+ }+ }+ lines}fn transcript_hyperlink_lines(&self, width: u16) -> Vec<HyperlinkLine> {diff --git a/codex-rs/tui/src/history_cell/tests.rs b/codex-rs/tui/src/history_cell/tests.rsindex 63a04d19d4..ec3ae49f21 100644--- a/codex-rs/tui/src/history_cell/tests.rs+++ b/codex-rs/tui/src/history_cell/tests.rs@@ -45,6 +45,24 @@ fn test_cwd() -> PathBuf {std::env::temp_dir()}+#[test]+fn streaming_agent_tail_blank_line_uses_one_viewport_row() {+ let cell = StreamingAgentTailCell::new(+ vec![+ HyperlinkLine::from("first"),+ HyperlinkLine::from(""),+ HyperlinkLine::from("second"),+ ],+ /*is_first_line*/ false,+ );++ let lines = cell.display_lines(/*width*/ 80);+ insta::assert_snapshot!(render_lines(&lines).join("\n"), @" first++ second");+ assert_eq!(cell.desired_height(/*width*/ 80), 3);+}+fn stdio_server_config(command: &str,args: Vec<&str>,