fix: strip ANSI sequences in footer tool status labels to prevent raw escape code leaks (#2481)

This commit is contained in:
Hanmiao Li
2026-06-01 14:03:45 +08:00
committed by Hunter B
parent c1f74b3b2f
commit 599b5997d0
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -398,8 +398,10 @@ fn collect_active_tool_status(cell: &HistoryCell, snapshot: &mut ActiveToolStatu
}
pub(crate) fn one_line_summary(text: &str, max_width: usize) -> String {
let mut cleaned = String::with_capacity(text.len());
crate::tui::osc8::strip_ansi_into(text, &mut cleaned);
truncate_line_to_width(
&text.split_whitespace().collect::<Vec<_>>().join(" "),
&cleaned.split_whitespace().collect::<Vec<_>>().join(" "),
max_width,
)
}
+3 -1
View File
@@ -72,7 +72,9 @@ pub(crate) fn concise_shell_command_label(command: &str, max_width: usize) -> St
}
fn normalize_shell_text(text: &str) -> String {
text.split_whitespace().collect::<Vec<_>>().join(" ")
let mut cleaned = String::with_capacity(text.len());
crate::tui::osc8::strip_ansi_into(text, &mut cleaned);
cleaned.split_whitespace().collect::<Vec<_>>().join(" ")
}
fn actionable_shell_segment(command: &str) -> Option<String> {