fix(tui): address review feedback

This commit is contained in:
Brooklyn Nicholson
2026-04-26 04:28:55 -05:00
parent 355e0ae960
commit 381121025e
4 changed files with 13 additions and 5 deletions

View File

@@ -42,9 +42,10 @@ describe('input metrics helpers', () => {
expect(inputVisualHeight('one\ntwo', 40)).toBe(2)
})
it('reserves a stable transcript scrollbar gutter for composer width', () => {
it('reserves gutters without exceeding the physical terminal width', () => {
expect(stableComposerColumns(100, 3)).toBe(93)
expect(stableComposerColumns(10, 3)).toBe(20)
expect(stableComposerColumns(10, 3)).toBe(3)
expect(stableComposerColumns(6, 3)).toBe(1)
})
})

View File

@@ -54,9 +54,9 @@ export function inputVisualHeight(value: string, columns: number) {
}
export function stableComposerColumns(totalCols: number, promptWidth: number) {
// totalCols is the terminal width. Reserve:
// Physical render/wrap width. Reserve:
// - outer composer paddingX={1}: 2 columns
// - transcript scrollbar gutter + marginLeft: 2 columns
// - prompt prefix width
return Math.max(20, totalCols - promptWidth - 4)
return Math.max(1, totalCols - promptWidth - 4)
}