mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 16:00:58 +00:00
fix(tui): trim trailing whitespace in wrapped lines to prevent width overflow
This commit is contained in:
parent
e4f8215f97
commit
786a326a71
2 changed files with 20 additions and 4 deletions
|
|
@ -498,7 +498,7 @@ function wrapSingleLine(line: string, width: number): string[] {
|
|||
const totalNeeded = currentVisibleLength + tokenVisibleLength;
|
||||
|
||||
if (totalNeeded > width && currentVisibleLength > 0) {
|
||||
// Add specific reset for underline only (preserves background)
|
||||
// Trim trailing whitespace, then add underline reset (not full reset, to preserve background)
|
||||
let lineToWrap = currentLine.trimEnd();
|
||||
const lineEndReset = tracker.getLineEndReset();
|
||||
if (lineEndReset) {
|
||||
|
|
@ -527,7 +527,8 @@ function wrapSingleLine(line: string, width: number): string[] {
|
|||
wrapped.push(currentLine);
|
||||
}
|
||||
|
||||
return wrapped.length > 0 ? wrapped : [""];
|
||||
// Trailing whitespace can cause lines to exceed the requested width
|
||||
return wrapped.length > 0 ? wrapped.map((line) => line.trimEnd()) : [""];
|
||||
}
|
||||
|
||||
const PUNCTUATION_REGEX = /[(){}[\]<>.,;:'"!?+\-=*/\\|&%^$#@~`]/;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue