From a2fe6336b66240c405cf1602db2065aea10fc425 Mon Sep 17 00:00:00 2001 From: pap Date: Fri, 1 Aug 2025 18:08:23 +0100 Subject: [PATCH] fixing /model dropdown if no args provided --- codex-rs/tui/src/app.rs | 5 ++++- codex-rs/tui/src/bottom_pane/chat_composer.rs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/codex-rs/tui/src/app.rs b/codex-rs/tui/src/app.rs index 6137c9bd1d..7a7377ff6e 100644 --- a/codex-rs/tui/src/app.rs +++ b/codex-rs/tui/src/app.rs @@ -394,7 +394,10 @@ impl App<'_> { })); } SlashCommand::Model => { - // Disallow `/model` without arguments; no action. + // Open the model selector when `/model` has no arguments. + if let AppState::Chat { widget } = &mut self.app_state { + widget.show_model_selector(); + } } }, AppEvent::DispatchCommandWithArgs(command, args) => match command { diff --git a/codex-rs/tui/src/bottom_pane/chat_composer.rs b/codex-rs/tui/src/bottom_pane/chat_composer.rs index 872ea3e343..475d2facfe 100644 --- a/codex-rs/tui/src/bottom_pane/chat_composer.rs +++ b/codex-rs/tui/src/bottom_pane/chat_composer.rs @@ -291,6 +291,18 @@ impl ChatComposer<'_> { String::new() }; + // Special-case: for `/model` with no arguments, keep the composer as "/model " + // so the model selector opens and the user can type to filter. + if *cmd == SlashCommand::Model && args.trim().is_empty() { + // Replace the entire input with "/model " (with a trailing space). + self.textarea.select_all(); + self.textarea.cut(); + let _ = self.textarea.insert_str(format!("/{} ", cmd.command())); + // Hide the slash-command popup; sync logic will open the model selector. + self.active_popup = ActivePopup::None; + return (InputResult::None, true); + } + // Send command + args to the app layer. self.app_event_tx .send(AppEvent::DispatchCommandWithArgs(*cmd, args));