mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-25 05:52:34 +00:00
fix(tui): preserve prompt separator width (#19340)
* fix(tui): preserve prompt separator width * fix(tui): align transcript height estimates with prompt width
This commit is contained in:
parent
d9c090fe36
commit
0ce1b9fe20
6 changed files with 85 additions and 7 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import { stringWidth } from '@hermes/ink'
|
||||
|
||||
import type { Role } from '../types.js'
|
||||
|
||||
export const COMPOSER_PROMPT_GAP_WIDTH = 1
|
||||
|
||||
let _seg: Intl.Segmenter | null = null
|
||||
|
|
@ -162,6 +164,14 @@ export function composerPromptWidth(promptText: string) {
|
|||
return Math.max(1, stringWidth(promptText)) + COMPOSER_PROMPT_GAP_WIDTH
|
||||
}
|
||||
|
||||
export function transcriptGutterWidth(role: Role, userPrompt: string) {
|
||||
return role === 'user' ? composerPromptWidth(userPrompt) : 3
|
||||
}
|
||||
|
||||
export function transcriptBodyWidth(totalCols: number, role: Role, userPrompt: string) {
|
||||
return Math.max(20, totalCols - transcriptGutterWidth(role, userPrompt) - 2)
|
||||
}
|
||||
|
||||
export function stableComposerColumns(totalCols: number, promptWidth: number) {
|
||||
// Physical render/wrap width. Always reserve outer composer padding and
|
||||
// prompt prefix. Only reserve the transcript scrollbar gutter when the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue