From e1b0b37ba49eefb891bf6226cb7b8f707bb9659e Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Sat, 3 Jan 2026 00:45:28 +0100 Subject: [PATCH] tui: wrap settings descriptions instead of truncating --- packages/tui/src/components/settings-list.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/tui/src/components/settings-list.ts b/packages/tui/src/components/settings-list.ts index a96bd0eb..5a273824 100644 --- a/packages/tui/src/components/settings-list.ts +++ b/packages/tui/src/components/settings-list.ts @@ -1,6 +1,6 @@ import { isArrowDown, isArrowUp, isCtrlC, isEnter, isEscape } from "../keys.js"; import type { Component } from "../tui.js"; -import { truncateToWidth, visibleWidth } from "../utils.js"; +import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "../utils.js"; export interface SettingItem { /** Unique identifier for this setting */ @@ -123,7 +123,10 @@ export class SettingsList implements Component { const selectedItem = this.items[this.selectedIndex]; if (selectedItem?.description) { lines.push(""); - lines.push(this.theme.description(` ${truncateToWidth(selectedItem.description, width - 4, "")}`)); + const wrappedDesc = wrapTextWithAnsi(selectedItem.description, width - 4); + for (const line of wrappedDesc) { + lines.push(this.theme.description(` ${line}`)); + } } // Add hint