diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index f8627f1a9..06c2808f2 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -2541,6 +2541,7 @@ impl Renderable for ChatComposer { hint_rect, buf, self.collaboration_mode_indicator, + !footer_props.is_task_running, left_content_width, ); } diff --git a/codex-rs/tui/src/bottom_pane/footer.rs b/codex-rs/tui/src/bottom_pane/footer.rs index e7aaabf83..ca83af901 100644 --- a/codex-rs/tui/src/bottom_pane/footer.rs +++ b/codex-rs/tui/src/bottom_pane/footer.rs @@ -56,18 +56,23 @@ pub(crate) enum CollaborationModeIndicator { const MODE_CYCLE_HINT: &str = "shift+tab to cycle"; impl CollaborationModeIndicator { - fn label(self) -> String { + fn label(self, show_cycle_hint: bool) -> String { + let suffix = if show_cycle_hint { + format!(" ({MODE_CYCLE_HINT})") + } else { + String::new() + }; match self { - CollaborationModeIndicator::Plan => format!("Plan mode ({MODE_CYCLE_HINT})"), + CollaborationModeIndicator::Plan => format!("Plan mode{suffix}"), CollaborationModeIndicator::PairProgramming => { - format!("Pair Programming mode ({MODE_CYCLE_HINT})") + format!("Pair Programming mode{suffix}") } - CollaborationModeIndicator::Execute => format!("Execute mode ({MODE_CYCLE_HINT})"), + CollaborationModeIndicator::Execute => format!("Execute mode{suffix}"), } } - fn styled_span(self) -> Span<'static> { - let label = self.label(); + fn styled_span(self, show_cycle_hint: bool) -> Span<'static> { + let label = self.label(show_cycle_hint); match self { CollaborationModeIndicator::Plan => Span::from(label).magenta(), CollaborationModeIndicator::PairProgramming => Span::from(label).cyan(), @@ -138,6 +143,7 @@ pub(crate) fn render_mode_indicator( area: Rect, buf: &mut Buffer, indicator: Option, + show_cycle_hint: bool, left_content_width: Option, ) { let Some(indicator) = indicator else { @@ -147,7 +153,7 @@ pub(crate) fn render_mode_indicator( return; } - let span = indicator.styled_span(); + let span = indicator.styled_span(show_cycle_hint); let label_width = span.width() as u16; if label_width == 0 || label_width > area.width { return; @@ -633,6 +639,7 @@ mod tests { area, f.buffer_mut(), indicator, + !props.is_task_running, Some(footer_line_width(props)), ); }) @@ -832,5 +839,24 @@ mod tests { props, Some(CollaborationModeIndicator::Plan), ); + + let props = FooterProps { + mode: FooterMode::ShortcutSummary, + esc_backtrack_hint: false, + use_shift_enter_hint: false, + is_task_running: true, + steer_enabled: false, + collaboration_modes_enabled: true, + quit_shortcut_key: key_hint::ctrl(KeyCode::Char('c')), + context_window_percent: None, + context_window_used_tokens: None, + }; + + snapshot_footer_with_indicator( + "footer_mode_indicator_running_hides_hint", + 120, + props, + Some(CollaborationModeIndicator::Plan), + ); } } diff --git a/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_mode_indicator_running_hides_hint.snap b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_mode_indicator_running_hides_hint.snap new file mode 100644 index 000000000..fe5868b87 --- /dev/null +++ b/codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_mode_indicator_running_hides_hint.snap @@ -0,0 +1,5 @@ +--- +source: tui/src/bottom_pane/footer.rs +expression: terminal.backend() +--- +" 100% context left ยท ? for shortcuts Plan mode "