diff options
| author | Matias <[email protected]> | 2025-07-16 00:35:58 -0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-16 03:35:58 +0000 |
| commit | d622e596a14338771bdd43a8812ff7fc02f7ebe8 (patch) | |
| tree | 81247df10964998cda08187ef11ed63a5aeaa9dc /packages/cli/src/ui/components/InputPrompt.tsx | |
| parent | 0903421b1a1c5b43f4271e779aafa440ffec595c (diff) | |
feat(cli): clear input buffer on CTRL+C when not executing commands (#1729)
Co-authored-by: Scott Densmore <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/components/InputPrompt.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/InputPrompt.tsx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx index 5edda273..41c88d6c 100644 --- a/packages/cli/src/ui/components/InputPrompt.tsx +++ b/packages/cli/src/ui/components/InputPrompt.tsx @@ -356,6 +356,16 @@ export const InputPrompt: React.FC<InputPromptProps> = ({ } if (key.ctrl && key.name === 'e') { buffer.move('end'); + buffer.moveToOffset(cpLen(buffer.text)); + return; + } + // Ctrl+C (Clear input) + if (key.ctrl && key.name === 'c') { + if (buffer.text.length > 0) { + buffer.setText(''); + resetCompletionState(); + return; + } return; } @@ -397,6 +407,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({ handleSubmitAndClear, shellHistory, handleClipboardImage, + resetCompletionState, ], ); |
