mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-04 02:21:47 +00:00
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:
parent
10fcd620d2
commit
d3ab2b2e13
2 changed files with 11 additions and 6 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue