mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-14 15:21:01 -07:00
refactor(cli): keyboard handling and AskUserDialog (#17414)
This commit is contained in:
@@ -40,22 +40,23 @@ export function TextInput({
|
||||
|
||||
const handleKeyPress = useCallback(
|
||||
(key: Key) => {
|
||||
if (key.name === 'escape') {
|
||||
onCancel?.();
|
||||
return;
|
||||
if (key.name === 'escape' && onCancel) {
|
||||
onCancel();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key.name === 'return') {
|
||||
onSubmit?.(text);
|
||||
return;
|
||||
if (key.name === 'return' && onSubmit) {
|
||||
onSubmit(text);
|
||||
return true;
|
||||
}
|
||||
|
||||
handleInput(key);
|
||||
const handled = handleInput(key);
|
||||
return handled;
|
||||
},
|
||||
[handleInput, onCancel, onSubmit, text],
|
||||
);
|
||||
|
||||
useKeypress(handleKeyPress, { isActive: focus });
|
||||
useKeypress(handleKeyPress, { isActive: focus, priority: true });
|
||||
|
||||
const showPlaceholder = text.length === 0 && placeholder;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user