From c6df75d886b49f278f2e565fca0580f1ca34df13 Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Thu, 5 Feb 2026 21:23:00 +1100 Subject: [PATCH] Fix shell tool output line clipping to account for suffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shell tool output line was wrapping because update_tool_output_line clipped the content without reserving space for the suffix that gets appended later (line count + timing info). Added suffix_overhead of 30 chars for shell tools to reserve space for: - " (9999 lines)" = ~13 chars - " | 99999 ◉ 999ms" = ~17 chars This ensures the complete line fits within terminal width without wrapping. --- crates/g3-cli/src/ui_writer_impl.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/g3-cli/src/ui_writer_impl.rs b/crates/g3-cli/src/ui_writer_impl.rs index 078a4fd..b054427 100644 --- a/crates/g3-cli/src/ui_writer_impl.rs +++ b/crates/g3-cli/src/ui_writer_impl.rs @@ -418,7 +418,14 @@ impl UiWriter for ConsoleUiWriter { let mut line_printed = self.output_line_printed.lock().unwrap(); let is_shell = *self.is_shell_compact.lock().unwrap(); let prefix_width = if is_shell { 6 } else { 3 }; - let max_content_width = get_terminal_width().saturating_sub(prefix_width); + // For shell, reserve space for suffix: " (N lines) | N ◉ Xms" + // - " (9999 lines)" = 13 chars max + // - " | 99999 ◉ 999ms" = 17 chars max + // Total suffix overhead: ~30 chars + let suffix_overhead = if is_shell { 30 } else { 0 }; + let max_content_width = get_terminal_width() + .saturating_sub(prefix_width) + .saturating_sub(suffix_overhead); // If we've already printed a line, clear it first if *line_printed {