Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 105 additions & 13 deletions codex-rs/tui/src/bottom_pane/chat_composer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2873,7 +2873,8 @@ impl ChatComposer {
}
ActivePopup::None => {
let footer_props = self.footer_props();
let show_cycle_hint = !footer_props.is_task_running;
let show_cycle_hint =
!footer_props.is_task_running && self.collaboration_mode_indicator.is_some();
let show_shortcuts_hint = match footer_props.mode {
FooterMode::ComposerEmpty => !self.is_in_paste_burst(),
FooterMode::QuitShortcutReminder
Expand Down Expand Up @@ -3353,45 +3354,79 @@ mod tests {
fn setup_collab_footer(
composer: &mut ChatComposer,
context_percent: i64,
indicator: CollaborationModeIndicator,
indicator: Option<CollaborationModeIndicator>,
) {
composer.set_collaboration_modes_enabled(true);
composer.set_collaboration_mode_indicator(Some(indicator));
composer.set_collaboration_mode_indicator(indicator);
composer.set_context_window(Some(context_percent), None);
}

// Empty textarea, agent idle: shortcuts hint can show, and cycle hint is available.
// Empty textarea, agent idle: shortcuts hint can show, and cycle hint is hidden.
snapshot_composer_state_with_width("footer_collapse_empty_full", 120, true, |composer| {
setup_collab_footer(composer, 100, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 100, None);
});
snapshot_composer_state_with_width(
"footer_collapse_empty_mode_cycle_with_context",
60,
true,
|composer| {
setup_collab_footer(composer, 100, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 100, None);
},
);
snapshot_composer_state_with_width(
"footer_collapse_empty_mode_cycle_without_context",
44,
true,
|composer| {
setup_collab_footer(composer, 100, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 100, None);
},
);
snapshot_composer_state_with_width(
"footer_collapse_empty_mode_only",
26,
true,
|composer| {
setup_collab_footer(composer, 100, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 100, None);
},
);

// Empty textarea, plan mode idle: shortcuts hint and cycle hint are available.
snapshot_composer_state_with_width(
"footer_collapse_plan_empty_full",
120,
true,
|composer| {
setup_collab_footer(composer, 100, Some(CollaborationModeIndicator::Plan));
},
);
snapshot_composer_state_with_width(
"footer_collapse_plan_empty_mode_cycle_with_context",
60,
true,
|composer| {
setup_collab_footer(composer, 100, Some(CollaborationModeIndicator::Plan));
},
);
snapshot_composer_state_with_width(
"footer_collapse_plan_empty_mode_cycle_without_context",
44,
true,
|composer| {
setup_collab_footer(composer, 100, Some(CollaborationModeIndicator::Plan));
},
);
snapshot_composer_state_with_width(
"footer_collapse_plan_empty_mode_only",
26,
true,
|composer| {
setup_collab_footer(composer, 100, Some(CollaborationModeIndicator::Plan));
},
);

// Textarea has content, agent running, steer enabled: queue hint is shown.
snapshot_composer_state_with_width("footer_collapse_queue_full", 120, true, |composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, None);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
Expand All @@ -3401,7 +3436,7 @@ mod tests {
50,
true,
|composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, None);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
Expand All @@ -3412,7 +3447,7 @@ mod tests {
40,
true,
|composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, None);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
Expand All @@ -3423,7 +3458,7 @@ mod tests {
30,
true,
|composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, None);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
Expand All @@ -3434,7 +3469,64 @@ mod tests {
20,
true,
|composer| {
setup_collab_footer(composer, 98, CollaborationModeIndicator::Code);
setup_collab_footer(composer, 98, None);
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
},
);

// Textarea has content, plan mode active, agent running, steer enabled: queue hint + mode.
snapshot_composer_state_with_width(
"footer_collapse_plan_queue_full",
120,
true,
|composer| {
setup_collab_footer(composer, 98, Some(CollaborationModeIndicator::Plan));
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
},
);
snapshot_composer_state_with_width(
"footer_collapse_plan_queue_short_with_context",
50,
true,
|composer| {
setup_collab_footer(composer, 98, Some(CollaborationModeIndicator::Plan));
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
},
);
snapshot_composer_state_with_width(
"footer_collapse_plan_queue_message_without_context",
40,
true,
|composer| {
setup_collab_footer(composer, 98, Some(CollaborationModeIndicator::Plan));
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
},
);
snapshot_composer_state_with_width(
"footer_collapse_plan_queue_short_without_context",
30,
true,
|composer| {
setup_collab_footer(composer, 98, Some(CollaborationModeIndicator::Plan));
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
},
);
snapshot_composer_state_with_width(
"footer_collapse_plan_queue_mode_only",
20,
true,
|composer| {
setup_collab_footer(composer, 98, Some(CollaborationModeIndicator::Plan));
composer.set_steer_enabled(true);
composer.set_task_running(true);
composer.set_text_content("Test".to_string(), Vec::new(), Vec::new());
Expand Down
9 changes: 5 additions & 4 deletions codex-rs/tui/src/bottom_pane/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ pub(crate) struct FooterProps {
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(crate) enum CollaborationModeIndicator {
Plan,
Code,
PairProgramming,
Execute,
}

const MODE_CYCLE_HINT: &str = "shift+tab to cycle";
const FOOTER_CONTEXT_GAP_COLS: u16 = 1;

impl CollaborationModeIndicator {
fn label(self, show_cycle_hint: bool) -> String {
Expand All @@ -89,7 +89,6 @@ impl CollaborationModeIndicator {
};
match self {
CollaborationModeIndicator::Plan => format!("Plan mode{suffix}"),
CollaborationModeIndicator::Code => format!("Code mode{suffix}"),
CollaborationModeIndicator::PairProgramming => {
format!("Pair Programming mode{suffix}")
}
Expand All @@ -101,7 +100,6 @@ impl CollaborationModeIndicator {
let label = self.label(show_cycle_hint);
match self {
CollaborationModeIndicator::Plan => Span::from(label).magenta(),
CollaborationModeIndicator::Code => Span::from(label).dim(),
CollaborationModeIndicator::PairProgramming => Span::from(label).cyan(),
CollaborationModeIndicator::Execute => Span::from(label).dim(),
}
Expand Down Expand Up @@ -475,7 +473,10 @@ pub(crate) fn can_show_left_with_context(area: Rect, left_width: u16, context_wi
let Some(context_x) = right_aligned_x(area, context_width) else {
return true;
};
let left_extent = FOOTER_INDENT_COLS as u16 + left_width;
if left_width == 0 {
return true;
}
let left_extent = FOOTER_INDENT_COLS as u16 + left_width + FOOTER_CONTEXT_GAP_COLS;
left_extent <= context_x.saturating_sub(area.x)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" ? for shortcuts · Code mode (shift+tab to cycle) 100% context left "
" ? for shortcuts 100% context left "
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" Code mode (shift+tab to cycle) 100% context left "
" ? for shortcuts 100% context left "
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" Code mode (shift+tab to cycle) "
" ? for shortcuts 100% context left "
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" Code mode "
" 100% context left "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Ask Codex to do anything "
" "
" "
" "
" "
" "
" "
" ? for shortcuts · Plan mode (shift+tab to cycle) 100% context left "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Ask Codex to do anything "
" "
" "
" "
" "
" "
" "
" Plan mode (shift+tab to cycle) 100% context left "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Ask Codex to do anything "
" "
" "
" "
" "
" "
" "
" Plan mode (shift+tab to cycle) "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Ask Codex to do anythin "
" "
" "
" "
" "
" "
" "
" Plan mode "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Test "
" "
" "
" "
" "
" "
" "
" tab to queue message · Plan mode 98% context left "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Test "
" "
" "
" "
" "
" "
" "
" tab to queue message · Plan mode "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Test "
" "
" "
" "
" "
" "
" "
" Plan mode "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Test "
" "
" "
" "
" "
" "
" "
" tab to queue · Plan mode 98% context left "
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
source: tui/src/bottom_pane/chat_composer.rs
expression: terminal.backend()
---
" "
"› Test "
" "
" "
" "
" "
" "
" "
" tab to queue · Plan mode "
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" tab to queue message · Code mode 98% context left "
" tab to queue message 98% context left "
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ expression: terminal.backend()
" "
" "
" "
" tab to queue message · Code mode "
" tab to queue 98% context left "
Loading
Loading