TUI: guard against overflow width crashes (#1686)
Co-authored-by: Mohammad Jafari <mossein@users.noreply.github.com>
This commit is contained in:
@@ -19,6 +19,7 @@ Status: unreleased.
|
||||
- Telegram: avoid block replies when streaming is disabled. (#1885) Thanks @ivancasco.
|
||||
- Auth: show copyable Google auth URL after ASCII prompt. (#1787) Thanks @robbyczgw-cla.
|
||||
- Routing: precompile session key regexes. (#1697) Thanks @Ray0907.
|
||||
- TUI: avoid width overflow when rendering selection lists. (#1686) Thanks @mossein.
|
||||
|
||||
## 2026.1.24-3
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ export class FilterableSelectList implements Component {
|
||||
lines.push(filterLabel + inputText);
|
||||
|
||||
// Separator
|
||||
lines.push(chalk.dim("─".repeat(width)));
|
||||
lines.push(chalk.dim("─".repeat(Math.max(0, width))));
|
||||
|
||||
// Select list
|
||||
const listLines = this.selectList.render(width);
|
||||
|
||||
@@ -214,7 +214,8 @@ export class SearchableSelectList implements Component {
|
||||
const maxValueWidth = Math.min(30, width - prefixWidth - 4);
|
||||
const truncatedValue = truncateToWidth(displayValue, maxValueWidth, "");
|
||||
const valueText = this.highlightMatch(truncatedValue, query);
|
||||
const spacing = " ".repeat(Math.max(1, 32 - visibleWidth(valueText)));
|
||||
const spacingWidth = Math.max(1, 32 - visibleWidth(valueText));
|
||||
const spacing = " ".repeat(spacingWidth);
|
||||
const descriptionStart = prefixWidth + visibleWidth(valueText) + spacing.length;
|
||||
const remainingWidth = width - descriptionStart - 2;
|
||||
if (remainingWidth > 10) {
|
||||
|
||||
Reference in New Issue
Block a user