tui: wrap settings descriptions instead of truncating
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { isArrowDown, isArrowUp, isCtrlC, isEnter, isEscape } from "../keys.js";
|
import { isArrowDown, isArrowUp, isCtrlC, isEnter, isEscape } from "../keys.js";
|
||||||
import type { Component } from "../tui.js";
|
import type { Component } from "../tui.js";
|
||||||
import { truncateToWidth, visibleWidth } from "../utils.js";
|
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "../utils.js";
|
||||||
|
|
||||||
export interface SettingItem {
|
export interface SettingItem {
|
||||||
/** Unique identifier for this setting */
|
/** Unique identifier for this setting */
|
||||||
@@ -123,7 +123,10 @@ export class SettingsList implements Component {
|
|||||||
const selectedItem = this.items[this.selectedIndex];
|
const selectedItem = this.items[this.selectedIndex];
|
||||||
if (selectedItem?.description) {
|
if (selectedItem?.description) {
|
||||||
lines.push("");
|
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
|
// Add hint
|
||||||
|
|||||||
Reference in New Issue
Block a user