Fix Windows terminal background rendering and add /debug command

- Strip carriage return characters from bash tool output to fix background padding on Windows
- Add hidden /debug command to write rendered lines to debug log for TUI debugging
- Document /debug command in README.md development section
This commit is contained in:
badlogic 2025-12-02 13:22:41 +01:00
parent 4432fc9b72
commit 7b1f975ca1
3 changed files with 63 additions and 3 deletions

View file

@ -83,8 +83,9 @@ export class ToolExecutionComponent extends Container {
const textBlocks = this.result.content?.filter((c: any) => c.type === "text") || [];
const imageBlocks = this.result.content?.filter((c: any) => c.type === "image") || [];
// Strip ANSI codes from raw output (bash may emit colors/formatting)
let output = textBlocks.map((c: any) => stripAnsi(c.text || "")).join("\n");
// Strip ANSI codes and carriage returns from raw output
// (bash may emit colors/formatting, and Windows may include \r)
let output = textBlocks.map((c: any) => stripAnsi(c.text || "").replace(/\r/g, "")).join("\n");
// Add indicator for images
if (imageBlocks.length > 0) {