Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

remove extra quote from disabled-command message (#3035)

Jeremy Rose619436c58fa2
diff --git a/codex-rs/tui/src/chatwidget.rs b/codex-rs/tui/src/chatwidget.rs
index 4695c6566c..946d6de901 100644
--- a/codex-rs/tui/src/chatwidget.rs
+++ b/codex-rs/tui/src/chatwidget.rs
@@ -766,7 +766,7 @@ impl ChatWidget {
fn dispatch_command(&mut self, cmd: SlashCommand) {
if !cmd.available_during_task() && self.bottom_pane.is_task_running() {
let message = format!(
- "'/'{}' is disabled while a task is in progress.",
+ "'/{}' is disabled while a task is in progress.",
cmd.command()
);
self.add_to_history(history_cell::new_error_event(message));
diff --git a/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__disabled_slash_command_while_task_running_snapshot.snap b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__disabled_slash_command_while_task_running_snapshot.snap
new file mode 100644
index 0000000000..52b6807b4d
--- /dev/null
+++ b/codex-rs/tui/src/chatwidget/snapshots/codex_tui__chatwidget__tests__disabled_slash_command_while_task_running_snapshot.snap
@@ -0,0 +1,5 @@
+---
+source: tui/src/chatwidget/tests.rs
+expression: blob
+---
+πŸ–β€Š '/model' is disabled while a task is in progress.
diff --git a/codex-rs/tui/src/chatwidget/tests.rs b/codex-rs/tui/src/chatwidget/tests.rs
index 758d28773a..117b4badcf 100644
--- a/codex-rs/tui/src/chatwidget/tests.rs
+++ b/codex-rs/tui/src/chatwidget/tests.rs
@@ -216,6 +216,25 @@ fn lines_to_single_string(lines: &[ratatui::text::Line<'static>]) -> String {
s
}
+#[test]
+fn disabled_slash_command_while_task_running_snapshot() {
+ // Build a chat widget and simulate an active task
+ let (mut chat, mut rx, _op_rx) = make_chatwidget_manual();
+ chat.bottom_pane.set_task_running(true);
+
+ // Dispatch a command that is unavailable while a task runs (e.g., /model)
+ chat.dispatch_command(SlashCommand::Model);
+
+ // Drain history and snapshot the rendered error line(s)
+ let cells = drain_insert_history(&mut rx);
+ assert!(
+ !cells.is_empty(),
+ "expected an error message history cell to be emitted",
+ );
+ let blob = lines_to_single_string(cells.last().unwrap());
+ assert_snapshot!(blob);
+}
+
fn open_fixture(name: &str) -> std::fs::File {
// 1) Prefer fixtures within this crate
{