fix: command formatting for user commands (#7002)

This commit is contained in:
jif-oai
2025-11-20 17:29:15 +01:00
committed by GitHub
parent b5dd189067
commit 888c6dd9e7
3 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
---
source: tui/src/chatwidget/tests.rs
expression: blob
---
• You ran ls
└ file1
file2

View File

@@ -1790,6 +1790,28 @@ fn exec_history_extends_previous_when_consecutive() {
assert_snapshot!("exploring_step6_finish_cat_bar", active_blob(&chat));
}
#[test]
fn user_shell_command_renders_output_not_exploring() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual();
let begin_ls = begin_exec_with_source(
&mut chat,
"user-shell-ls",
"ls",
ExecCommandSource::UserShell,
);
end_exec(&mut chat, begin_ls, "file1\nfile2\n", "", 0);
let cells = drain_insert_history(&mut rx);
assert_eq!(
cells.len(),
1,
"expected a single history cell for the user command"
);
let blob = lines_to_single_string(cells.first().unwrap());
assert_snapshot!("user_shell_ls_output", blob);
}
#[test]
fn disabled_slash_command_while_task_running_snapshot() {
// Build a chat widget and simulate an active task

View File

@@ -117,7 +117,8 @@ impl ExecCell {
}
pub(super) fn is_exploring_call(call: &ExecCall) -> bool {
!call.parsed.is_empty()
!matches!(call.source, ExecCommandSource::UserShell)
&& !call.parsed.is_empty()
&& call.parsed.iter().all(|p| {
matches!(
p,