feat(tui): make prompt size responsive and configurable (#28255)

This commit is contained in:
Braxton Schafer
2026-05-25 09:24:19 -05:00
committed by GitHub
parent 7703786498
commit 0de5f1ff36
3 changed files with 29 additions and 4 deletions
@@ -1464,11 +1464,15 @@ export function Prompt(props: PromptProps) {
}),
}
})
const maxHeight = createMemo(
() => tuiConfig.prompt?.max_height ?? Math.max(6, Math.floor(dimensions().height / 3)),
)
return (
<>
<box ref={(r: BoxRenderable) => (anchor = r)} visible={props.visible !== false}>
<box ref={(r: BoxRenderable) => (anchor = r)} visible={props.visible !== false} width="100%">
<box
width="100%"
border={["left"]}
borderColor={borderHighlight()}
customBorderChars={{
@@ -1483,14 +1487,16 @@ export function Prompt(props: PromptProps) {
flexShrink={0}
backgroundColor={theme.backgroundElement}
flexGrow={1}
width="100%"
>
<textarea
width="100%"
placeholder={placeholderText()}
placeholderColor={theme.textMuted}
textColor={leader() ? theme.textMuted : theme.text}
focusedTextColor={leader() ? theme.textMuted : theme.text}
minHeight={1}
maxHeight={6}
maxHeight={maxHeight()}
onContentChange={() => {
const value = input.plainText
setStore("prompt", "input", value)