Collapse whitespace in ProgressUI tool call display to prevent line breaks

Multi-line arguments (e.g. spawn_agent task descriptions) were breaking
the single-line progress output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-04 10:25:43 -05:00
parent 28b5d485c1
commit 5fd4a5ea2e

View file

@ -92,12 +92,13 @@ fn format_number(n: f64) -> String {
// ── Tool call display name ──────────────────────────────────────────────
fn truncate(s: &str, max: usize) -> String {
if s.len() > max {
let mut t: String = s.chars().take(max - 3).collect();
let single_line: String = s.split_whitespace().collect::<Vec<_>>().join(" ");
if single_line.len() > max {
let mut t: String = single_line.chars().take(max - 3).collect();
t.push_str("...");
t
} else {
s.to_string()
single_line
}
}