Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

removing quit from dropdown menu, but not autocomplete [cli] (#10128)

natea-oaiecc66f4f52d4
diff --git a/codex-rs/tui/src/bottom_pane/command_popup.rs b/codex-rs/tui/src/bottom_pane/command_popup.rs
index e879e880cc..c1cdd5374d 100644
--- a/codex-rs/tui/src/bottom_pane/command_popup.rs
+++ b/codex-rs/tui/src/bottom_pane/command_popup.rs
@@ -120,6 +120,10 @@ impl CommandPopup {
if filter.is_empty() {
// Built-ins first, in presentation order.
for (_, cmd) in self.builtins.iter() {
+ // Skipping quit as it's a duplicate of exit.
+ if *cmd == SlashCommand::Quit {
+ continue;
+ }
out.push((CommandItem::Builtin(*cmd), None));
}
// Then prompts, already sorted by name.
@@ -437,6 +441,18 @@ mod tests {
);
}
+ #[test]
+ fn quit_hidden_in_empty_filter_but_shown_for_prefix() {
+ let mut popup = CommandPopup::new(Vec::new(), CommandPopupFlags::default());
+ popup.on_composer_text_change("/".to_string());
+ let items = popup.filtered_items();
+ assert!(!items.contains(&CommandItem::Builtin(SlashCommand::Quit)));
+
+ popup.on_composer_text_change("/qu".to_string());
+ let items = popup.filtered_items();
+ assert!(items.contains(&CommandItem::Builtin(SlashCommand::Quit)));
+ }
+
#[test]
fn collab_command_hidden_when_collaboration_modes_disabled() {
let mut popup = CommandPopup::new(Vec::new(), CommandPopupFlags::default());