fix(tui): share composer prompt gap metric

Use one exported prompt gap constant for both composer width math and prompt prefix rendering.
This commit is contained in:
Brooklyn Nicholson 2026-04-29 15:50:54 -05:00
parent 10fcd620d2
commit d3ab2b2e13
2 changed files with 11 additions and 6 deletions

View file

@ -1,5 +1,7 @@
import { stringWidth } from '@hermes/ink'
export const COMPOSER_PROMPT_GAP_WIDTH = 1
let _seg: Intl.Segmenter | null = null
const seg = () => (_seg ??= new Intl.Segmenter(undefined, { granularity: 'grapheme' }))
@ -54,7 +56,7 @@ export function inputVisualHeight(value: string, columns: number) {
}
export function composerPromptWidth(promptText: string) {
return Math.max(1, stringWidth(promptText)) + 1
return Math.max(1, stringWidth(promptText)) + COMPOSER_PROMPT_GAP_WIDTH
}
export function stableComposerColumns(totalCols: number, promptWidth: number) {