Add Esc-Esc to clear prompt when it's not empty#17131
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
Size Change: +461 B (0%) Total Size: 23.2 MB ℹ️ View Unchanged
|
|
do we want both |
…e esc-esc can't be shown in docs
yep! |
| // Second ESC | ||
| resetEscapeState(); | ||
| onSubmit('/rewind'); | ||
| if (keyMatchers[Command.ESCAPE](key) && buffer.text.length > 0) { |
There was a problem hiding this comment.
we do we check for the escape key press for the if case but not the else case? Would think both should be the same except for the buffer.text.length check
There was a problem hiding this comment.
Added check in else case
There was a problem hiding this comment.
please revert both these checks for
keyMatchersCommand.ESCAPE
as line 453 is already checking that they key is escape so this just makes the logic confusing.
| const isPromptEmpty = uiState.buffer.text.length === 0; | ||
| return ( | ||
| <Text color={theme.text.secondary}> | ||
| Press Esc again to {isPromptEmpty ? 'rewind' : 'clear prompt'}. |
There was a problem hiding this comment.
We should not show either message if there is no history to rewind yet.
There was a problem hiding this comment.
Added check for history first
There was a problem hiding this comment.
sorry I wasn't clear. I mean we should not show either if their is no history and the message is empty.
There was a problem hiding this comment.
updated check for not showing any toast when prompt is empty and there's no history
jacob314
left a comment
There was a problem hiding this comment.
Approved after these comments are addressed
| buffer.setText(''); | ||
| resetCompletionState(); | ||
| } else if (keyMatchers[Command.ESCAPE](key)) { | ||
| } else { |
There was a problem hiding this comment.
nit: avoid double nesting. this can just be else if (...
There was a problem hiding this comment.
Acknowledged. Thank you for addressing this in a follow-up PR.
|
/patch preview |
|
✅ Patch workflow(s) dispatched successfully! 📋 Details:
🔗 Track Progress: |
# Conflicts: # docs/cli/keyboard-shortcuts.md # packages/cli/src/ui/components/InputPrompt.test.tsx # packages/cli/src/ui/components/InputPrompt.tsx # packages/cli/src/ui/components/StatusDisplay.tsx # packages/cli/src/ui/components/__snapshots__/StatusDisplay.test.tsx.snap
|
🚀 Patch PR Created! 📋 Patch Details:
📝 Next Steps:
🔗 Track Progress: |

Summary
As title suggests
Details
Decision was made during UX meeting
Related Issues
How to Validate
If you write text in the prompt and press
Esc-Escit should clear it. If the prompt is empty and you runEsc-Escthen it should run the slash command/rewindPre-Merge Checklist