mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-30 15:04:16 -07:00
refactor(cli): keyboard handling and AskUserDialog (#17414)
This commit is contained in:
@@ -1401,7 +1401,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
setCopyModeEnabled(false);
|
||||
enableMouseEvents();
|
||||
// We don't want to process any other keys if we're in copy mode.
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Debug log keystrokes if enabled
|
||||
@@ -1412,7 +1412,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
if (isAlternateBuffer && keyMatchers[Command.TOGGLE_COPY_MODE](key)) {
|
||||
setCopyModeEnabled(true);
|
||||
disableMouseEvents();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keyMatchers[Command.QUIT](key)) {
|
||||
@@ -1425,13 +1425,13 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
cancelOngoingRequest?.();
|
||||
|
||||
setCtrlCPressCount((prev) => prev + 1);
|
||||
return;
|
||||
return true;
|
||||
} else if (keyMatchers[Command.EXIT](key)) {
|
||||
if (buffer.text.length > 0) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
setCtrlDPressCount((prev) => prev + 1);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
let enteringConstrainHeightMode = false;
|
||||
@@ -1442,8 +1442,10 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
|
||||
if (keyMatchers[Command.SHOW_ERROR_DETAILS](key)) {
|
||||
setShowErrorDetails((prev) => !prev);
|
||||
return true;
|
||||
} else if (keyMatchers[Command.SHOW_FULL_TODOS](key)) {
|
||||
setShowFullTodos((prev) => !prev);
|
||||
return true;
|
||||
} else if (keyMatchers[Command.TOGGLE_MARKDOWN](key)) {
|
||||
setRenderMarkdown((prev) => {
|
||||
const newValue = !prev;
|
||||
@@ -1451,6 +1453,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
refreshStatic();
|
||||
return newValue;
|
||||
});
|
||||
return true;
|
||||
} else if (
|
||||
keyMatchers[Command.SHOW_IDE_CONTEXT_DETAIL](key) &&
|
||||
config.getIdeMode() &&
|
||||
@@ -1458,11 +1461,13 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
handleSlashCommand('/ide status');
|
||||
return true;
|
||||
} else if (
|
||||
keyMatchers[Command.SHOW_MORE_LINES](key) &&
|
||||
!enteringConstrainHeightMode
|
||||
) {
|
||||
setConstrainHeight(false);
|
||||
return true;
|
||||
} else if (
|
||||
keyMatchers[Command.UNFOCUS_SHELL_INPUT](key) &&
|
||||
activePtyId &&
|
||||
@@ -1471,7 +1476,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
if (key.name === 'tab' && key.shift) {
|
||||
// Always change focus
|
||||
setEmbeddedShellFocused(false);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const now = Date.now();
|
||||
@@ -1491,10 +1496,12 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
}
|
||||
setEmbeddedShellFocused(false);
|
||||
}, 100);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
handleWarning('Press Shift+Tab to focus out.');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
[
|
||||
constrainHeight,
|
||||
|
||||
Reference in New Issue
Block a user