mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 19:04:37 +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
|
|
@ -103,8 +103,11 @@ export class Markdown implements Component {
|
|||
return result;
|
||||
}
|
||||
|
||||
// Replace tabs with 3 spaces for consistent rendering
|
||||
const normalizedText = this.text.replace(/\t/g, " ");
|
||||
|
||||
// Parse markdown to HTML-like tokens
|
||||
const tokens = marked.lexer(this.text);
|
||||
const tokens = marked.lexer(normalizedText);
|
||||
|
||||
// Convert tokens to styled terminal output
|
||||
const renderedLines: string[] = [];
|
||||
|
|
|
|||
|
|
@ -63,8 +63,11 @@ export class Text implements Component {
|
|||
return result;
|
||||
}
|
||||
|
||||
// Replace tabs with 3 spaces for consistent rendering
|
||||
const normalizedText = this.text.replace(/\t/g, " ");
|
||||
|
||||
const lines: string[] = [];
|
||||
const textLines = this.text.split("\n");
|
||||
const textLines = normalizedText.split("\n");
|
||||
|
||||
for (const line of textLines) {
|
||||
// Measure visible length (strip ANSI codes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue