Skip to content

Commit 619436c

Browse files
remove extra quote from disabled-command message (#3035)
there was an extra ' floating around for some reason.
1 parent 1cc6b97 commit 619436c

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

codex-rs/tui/src/chatwidget.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ impl ChatWidget {
766766
fn dispatch_command(&mut self, cmd: SlashCommand) {
767767
if !cmd.available_during_task() && self.bottom_pane.is_task_running() {
768768
let message = format!(
769-
"'/'{}' is disabled while a task is in progress.",
769+
"'/{}' is disabled while a task is in progress.",
770770
cmd.command()
771771
);
772772
self.add_to_history(history_cell::new_error_event(message));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
source: tui/src/chatwidget/tests.rs
3+
expression: blob
4+
---
5+
🖐  '/model' is disabled while a task is in progress.

codex-rs/tui/src/chatwidget/tests.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,25 @@ fn lines_to_single_string(lines: &[ratatui::text::Line<'static>]) -> String {
216216
s
217217
}
218218

219+
#[test]
220+
fn disabled_slash_command_while_task_running_snapshot() {
221+
// Build a chat widget and simulate an active task
222+
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual();
223+
chat.bottom_pane.set_task_running(true);
224+
225+
// Dispatch a command that is unavailable while a task runs (e.g., /model)
226+
chat.dispatch_command(SlashCommand::Model);
227+
228+
// Drain history and snapshot the rendered error line(s)
229+
let cells = drain_insert_history(&mut rx);
230+
assert!(
231+
!cells.is_empty(),
232+
"expected an error message history cell to be emitted",
233+
);
234+
let blob = lines_to_single_string(cells.last().unwrap());
235+
assert_snapshot!(blob);
236+
}
237+
219238
fn open_fixture(name: &str) -> std::fs::File {
220239
// 1) Prefer fixtures within this crate
221240
{

0 commit comments

Comments
 (0)