fix(tui): stop wide input slice overflow closes #1982 (#2006)

This commit is contained in:
Fero
2026-03-09 23:19:26 +01:00
committed by GitHub
parent fd0c7c3bdb
commit 15e0957b04
3 changed files with 22 additions and 9 deletions

View File

@@ -468,8 +468,8 @@ export class Input implements Component, Focusable {
startCol = Math.max(0, cursorCol - halfWidth);
}
visibleText = sliceByColumn(this.value, startCol, scrollWidth);
const beforeCursor = sliceByColumn(this.value, startCol, Math.max(0, cursorCol - startCol));
visibleText = sliceByColumn(this.value, startCol, scrollWidth, true);
const beforeCursor = sliceByColumn(this.value, startCol, Math.max(0, cursorCol - startCol), true);
cursorDisplay = beforeCursor.length;
} else {
visibleText = "";