feat(ui): add cursor to empty input prompt (#800)

This commit is contained in:
Jacob Richman 2025-06-06 13:44:11 -07:00 committed by GitHub
parent 21acdee0a0
commit 2f54aa888a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -39,7 +39,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
onClearScreen,
config,
slashCommands,
placeholder = 'Type your message or @path/to/file',
placeholder = ' Type your message or @path/to/file',
height = 10,
focus = true,
widthFraction,
@ -349,7 +349,14 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
</Text>
<Box flexGrow={1} flexDirection="column">
{buffer.text.length === 0 && placeholder ? (
<Text color={Colors.Gray}>{placeholder}</Text>
focus ? (
<Text>
{chalk.inverse(placeholder.slice(0, 1))}
<Text color={Colors.Gray}>{placeholder.slice(1)}</Text>
</Text>
) : (
<Text color={Colors.Gray}>{placeholder}</Text>
)
) : (
linesToRender.map((lineText, visualIdxInRenderedSet) => {
const cursorVisualRow = cursorVisualRowAbsolute - scrollVisualRow;