From 76c2da4f96137ebfba0a23b2d5ff2a17742c95f9 Mon Sep 17 00:00:00 2001 From: Charles Cunningham Date: Mon, 2 Mar 2026 12:02:34 -0800 Subject: [PATCH] tui: rename queued messages in pending preview --- codex-rs/tui/src/bottom_pane/mod.rs | 4 +- .../src/bottom_pane/pending_input_preview.rs | 48 ++++++++++++------- codex-rs/tui/src/chatwidget.rs | 4 +- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/codex-rs/tui/src/bottom_pane/mod.rs b/codex-rs/tui/src/bottom_pane/mod.rs index c33bfb209b..a3cf1cc1e1 100644 --- a/codex-rs/tui/src/bottom_pane/mod.rs +++ b/codex-rs/tui/src/bottom_pane/mod.rs @@ -776,7 +776,7 @@ impl BottomPane { pending_steers: Vec, ) { self.pending_input_preview.pending_steers = pending_steers; - self.pending_input_preview.messages = queued; + self.pending_input_preview.queued_messages = queued; self.request_redraw(); } @@ -1019,7 +1019,7 @@ impl BottomPane { flex.push(0, RenderableItem::Borrowed(&self.unified_exec_footer)); } let has_pending_thread_approvals = !self.pending_thread_approvals.is_empty(); - let has_pending_input = !self.pending_input_preview.messages.is_empty() + let has_pending_input = !self.pending_input_preview.queued_messages.is_empty() || !self.pending_input_preview.pending_steers.is_empty(); let has_status_or_footer = self.status.is_some() || !self.unified_exec_footer.is_empty(); diff --git a/codex-rs/tui/src/bottom_pane/pending_input_preview.rs b/codex-rs/tui/src/bottom_pane/pending_input_preview.rs index d5e1d37131..da7bc8cb69 100644 --- a/codex-rs/tui/src/bottom_pane/pending_input_preview.rs +++ b/codex-rs/tui/src/bottom_pane/pending_input_preview.rs @@ -19,7 +19,7 @@ use crate::wrapping::adaptive_wrap_lines; /// configurable via [`set_edit_binding`](Self::set_edit_binding). pub(crate) struct PendingInputPreview { pub pending_steers: Vec, - pub messages: Vec, + pub queued_messages: Vec, /// Key combination rendered in the hint line. Defaults to Alt+Up but may /// be overridden for terminals where that chord is unavailable. edit_binding: key_hint::KeyBinding, @@ -29,7 +29,7 @@ impl PendingInputPreview { pub(crate) fn new() -> Self { Self { pending_steers: Vec::new(), - messages: Vec::new(), + queued_messages: Vec::new(), edit_binding: key_hint::alt(KeyCode::Up), } } @@ -42,7 +42,7 @@ impl PendingInputPreview { } fn as_renderable(&self, width: u16) -> Box { - if (self.pending_steers.is_empty() && self.messages.is_empty()) || width < 4 { + if (self.pending_steers.is_empty() && self.queued_messages.is_empty()) || width < 4 { return Box::new(()); } @@ -66,7 +66,7 @@ impl PendingInputPreview { } } - for message in &self.messages { + for message in &self.queued_messages { let wrapped = adaptive_wrap_lines( message.lines().map(|line| line.dim().italic()), RtOptions::new(width as usize) @@ -82,7 +82,7 @@ impl PendingInputPreview { } } - if !self.messages.is_empty() { + if !self.queued_messages.is_empty() { lines.push( Line::from(vec![ " ".into(), @@ -126,14 +126,14 @@ mod tests { #[test] fn desired_height_one_message() { let mut queue = PendingInputPreview::new(); - queue.messages.push("Hello, world!".to_string()); + queue.queued_messages.push("Hello, world!".to_string()); assert_eq!(queue.desired_height(40), 2); } #[test] fn render_one_message() { let mut queue = PendingInputPreview::new(); - queue.messages.push("Hello, world!".to_string()); + queue.queued_messages.push("Hello, world!".to_string()); let width = 40; let height = queue.desired_height(width); let mut buf = Buffer::empty(Rect::new(0, 0, width, height)); @@ -144,8 +144,10 @@ mod tests { #[test] fn render_two_messages() { let mut queue = PendingInputPreview::new(); - queue.messages.push("Hello, world!".to_string()); - queue.messages.push("This is another message".to_string()); + queue.queued_messages.push("Hello, world!".to_string()); + queue + .queued_messages + .push("This is another message".to_string()); let width = 40; let height = queue.desired_height(width); let mut buf = Buffer::empty(Rect::new(0, 0, width, height)); @@ -156,10 +158,16 @@ mod tests { #[test] fn render_more_than_three_messages() { let mut queue = PendingInputPreview::new(); - queue.messages.push("Hello, world!".to_string()); - queue.messages.push("This is another message".to_string()); - queue.messages.push("This is a third message".to_string()); - queue.messages.push("This is a fourth message".to_string()); + queue.queued_messages.push("Hello, world!".to_string()); + queue + .queued_messages + .push("This is another message".to_string()); + queue + .queued_messages + .push("This is a third message".to_string()); + queue + .queued_messages + .push("This is a fourth message".to_string()); let width = 40; let height = queue.desired_height(width); let mut buf = Buffer::empty(Rect::new(0, 0, width, height)); @@ -171,9 +179,11 @@ mod tests { fn render_wrapped_message() { let mut queue = PendingInputPreview::new(); queue - .messages + .queued_messages .push("This is a longer message that should be wrapped".to_string()); - queue.messages.push("This is another message".to_string()); + queue + .queued_messages + .push("This is another message".to_string()); let width = 40; let height = queue.desired_height(width); let mut buf = Buffer::empty(Rect::new(0, 0, width, height)); @@ -185,7 +195,7 @@ mod tests { fn render_many_line_message() { let mut queue = PendingInputPreview::new(); queue - .messages + .queued_messages .push("This is\na message\nwith many\nlines".to_string()); let width = 40; let height = queue.desired_height(width); @@ -197,7 +207,7 @@ mod tests { #[test] fn long_url_like_message_does_not_expand_into_wrapped_ellipsis_rows() { let mut queue = PendingInputPreview::new(); - queue.messages.push( + queue.queued_messages.push( "example.test/api/v1/projects/alpha-team/releases/2026-02-17/builds/1234567890/artifacts/reports/performance/summary/detail/session_id=abc123def456ghi789" .to_string(), ); @@ -244,7 +254,9 @@ mod tests { queue .pending_steers .push("Check the last command output.".to_string()); - queue.messages.push("Queued follow-up question".to_string()); + queue + .queued_messages + .push("Queued follow-up question".to_string()); let width = 52; let height = queue.desired_height(width); let mut buf = Buffer::empty(Rect::new(0, 0, width, height)); diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs index ce255a3028..6b129cf26a 100644 --- a/codex-rs/tui/src/chatwidget.rs +++ b/codex-rs/tui/src/chatwidget.rs @@ -4803,7 +4803,7 @@ impl ChatWidget { /// Rebuild and update the bottom-pane pending-input preview. fn refresh_pending_input_preview(&mut self) { - let messages: Vec = self + let queued_messages: Vec = self .queued_user_messages .iter() .map(|m| m.text.clone()) @@ -4814,7 +4814,7 @@ impl ChatWidget { .map(|steer| steer.message().to_string()) .collect(); self.bottom_pane - .set_pending_input_preview(messages, pending_steers); + .set_pending_input_preview(queued_messages, pending_steers); } pub(crate) fn set_pending_thread_approvals(&mut self, threads: Vec) {