diff --git a/packages/coding-agent/src/modes/interactive/components/footer.ts b/packages/coding-agent/src/modes/interactive/components/footer.ts index f8865d2d..26b21269 100644 --- a/packages/coding-agent/src/modes/interactive/components/footer.ts +++ b/packages/coding-agent/src/modes/interactive/components/footer.ts @@ -118,7 +118,7 @@ export class FooterComponent implements Component { // Truncate path if too long to fit width if (pwd.length > width) { const half = Math.floor(width / 2) - 2; - if (half > 0) { + if (half > 1) { const start = pwd.slice(0, half); const end = pwd.slice(-(half - 1)); pwd = `${start}...${end}`; diff --git a/packages/tui/src/components/settings-list.ts b/packages/tui/src/components/settings-list.ts index 9357906a..e6d01348 100644 --- a/packages/tui/src/components/settings-list.ts +++ b/packages/tui/src/components/settings-list.ts @@ -98,15 +98,15 @@ export class SettingsList implements Component { if (this.items.length === 0) { lines.push(this.theme.hint(" No settings available")); if (this.searchEnabled) { - this.addHintLine(lines); + this.addHintLine(lines, width); } return lines; } const displayItems = this.searchEnabled ? this.filteredItems : this.items; if (displayItems.length === 0) { - lines.push(this.theme.hint(" No matching settings")); - this.addHintLine(lines); + lines.push(truncateToWidth(this.theme.hint(" No matching settings"), width)); + this.addHintLine(lines, width); return lines; } @@ -140,7 +140,7 @@ export class SettingsList implements Component { const valueText = this.theme.value(truncateToWidth(item.currentValue, valueMaxWidth, ""), isSelected); - lines.push(prefix + labelText + separator + valueText); + lines.push(truncateToWidth(prefix + labelText + separator + valueText, width)); } // Add scroll indicator if needed @@ -160,7 +160,7 @@ export class SettingsList implements Component { } // Add hint - this.addHintLine(lines); + this.addHintLine(lines, width); return lines; } @@ -234,13 +234,16 @@ export class SettingsList implements Component { this.selectedIndex = 0; } - private addHintLine(lines: string[]): void { + private addHintLine(lines: string[], width: number): void { lines.push(""); lines.push( - this.theme.hint( - this.searchEnabled - ? " Type to search · Enter/Space to change · Esc to cancel" - : " Enter/Space to change · Esc to cancel", + truncateToWidth( + this.theme.hint( + this.searchEnabled + ? " Type to search · Enter/Space to change · Esc to cancel" + : " Enter/Space to change · Esc to cancel", + ), + width, ), ); }