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

there was an extra ' floating around for some reason.
This commit is contained in:
Jeremy Rose
2025-09-02 09:46:41 -07:00
committed by GitHub
parent 1cc6b97227
commit 619436c58f
3 changed files with 25 additions and 1 deletions

View File

@@ -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));

View File

@@ -0,0 +1,5 @@
---
source: tui/src/chatwidget/tests.rs
expression: blob
---
🖐  '/model' is disabled while a task is in progress.

View File

@@ -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
{