diff --git a/ui-tui/src/components/appLayout.tsx b/ui-tui/src/components/appLayout.tsx index bd78c31f47..641b334301 100644 --- a/ui-tui/src/components/appLayout.tsx +++ b/ui-tui/src/components/appLayout.tsx @@ -9,7 +9,12 @@ import { $uiState } from '../app/uiStore.js' import { INLINE_MODE, SHOW_FPS } from '../config/env.js' import { FULL_RENDER_TAIL_ITEMS } from '../config/limits.js' import { PLACEHOLDER } from '../content/placeholders.js' -import { composerPromptWidth, inputVisualHeight, stableComposerColumns } from '../lib/inputMetrics.js' +import { + COMPOSER_PROMPT_GAP_WIDTH, + composerPromptWidth, + inputVisualHeight, + stableComposerColumns +} from '../lib/inputMetrics.js' import { PerfPane } from '../lib/perfPane.js' import { AgentsOverlay } from './agentsOverlay.js' @@ -22,8 +27,6 @@ import { QueuedMessages } from './queuedMessages.js' import { LiveTodoPanel, StreamingAssistant } from './streamingAssistant.js' import { TextInput, type TextInputMouseApi } from './textInput.js' -const PROMPT_GAP_WIDTH = 1 - const PromptPrefix = memo(function PromptPrefix({ bold = false, color, @@ -35,7 +38,7 @@ const PromptPrefix = memo(function PromptPrefix({ promptText: string width: number }) { - const glyphWidth = Math.max(1, stringWidth(promptText)) + const glyphWidth = Math.max(1, width - COMPOSER_PROMPT_GAP_WIDTH) return ( @@ -44,7 +47,7 @@ const PromptPrefix = memo(function PromptPrefix({ {promptText} - + ) }) diff --git a/ui-tui/src/lib/inputMetrics.ts b/ui-tui/src/lib/inputMetrics.ts index f110221a56..3d824be3ea 100644 --- a/ui-tui/src/lib/inputMetrics.ts +++ b/ui-tui/src/lib/inputMetrics.ts @@ -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) {