mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 00:04:50 +00:00
Fix tab rendering in TUI components
Replace tabs with 3 spaces for consistent rendering and width calculation: - Updated visibleWidth() to normalize tabs before measuring - Updated Text and Markdown components to replace tabs when rendering - Updated tool-execution display for read/write tools to replace tabs This fixes background color rendering issues when displaying files with tab indentation.
This commit is contained in:
parent
7beb354337
commit
001beff394
5 changed files with 49 additions and 5 deletions
|
|
@ -6,7 +6,10 @@ import stringWidth from "string-width";
|
|||
* - ANSI escape codes (ignored)
|
||||
* - Emojis and wide characters (counted as 2 columns)
|
||||
* - Combining characters (counted correctly)
|
||||
* - Tabs (replaced with 3 spaces for consistent width)
|
||||
*/
|
||||
export function visibleWidth(str: string): number {
|
||||
return stringWidth(str);
|
||||
// Replace tabs with 3 spaces before measuring
|
||||
const normalized = str.replace(/\t/g, " ");
|
||||
return stringWidth(normalized);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue