feat(cli): disable ctrl-s shortcut outside of alternate buffer mode (#18887)

This commit is contained in:
Jacob Richman
2026-02-12 15:00:13 -08:00
committed by GitHub
parent 44bcba323f
commit 55ec0f043c
4 changed files with 39 additions and 33 deletions

View File

@@ -286,10 +286,7 @@ export const defaultKeyBindings: KeyBindingConfig = {
[Command.SHOW_SHELL_INPUT_UNFOCUS_WARNING]: [{ key: 'tab', shift: false }],
[Command.BACKGROUND_SHELL_SELECT]: [{ key: 'return' }],
[Command.BACKGROUND_SHELL_ESCAPE]: [{ key: 'escape' }],
[Command.SHOW_MORE_LINES]: [
{ key: 'o', ctrl: true },
{ key: 's', ctrl: true },
],
[Command.SHOW_MORE_LINES]: [{ key: 'o', ctrl: true }],
[Command.EXPAND_PASTE]: [{ key: 'o', ctrl: true }],
[Command.FOCUS_SHELL_INPUT]: [{ key: 'tab', shift: false }],
[Command.UNFOCUS_SHELL_INPUT]: [{ key: 'tab', shift: true }],
@@ -501,7 +498,7 @@ export const commandDescriptions: Readonly<Record<Command, string>> = {
[Command.CYCLE_APPROVAL_MODE]:
'Cycle through approval modes: default (prompt), auto_edit (auto-approve edits), and plan (read-only).',
[Command.SHOW_MORE_LINES]:
'Expand a height-constrained response to show additional lines when not in alternate buffer mode.',
'Expand and collapse blocks of content when not in alternate buffer mode.',
[Command.EXPAND_PASTE]:
'Expand or collapse a paste placeholder when cursor is over placeholder.',
[Command.BACKGROUND_SHELL_SELECT]:

View File

@@ -1620,6 +1620,14 @@ Logging in with Google... Restarting Gemini CLI to continue.
return true;
} else if (keyMatchers[Command.SUSPEND_APP](key)) {
handleSuspend();
} else if (
keyMatchers[Command.TOGGLE_COPY_MODE](key) &&
!isAlternateBuffer
) {
showTransientMessage({
text: 'Use Ctrl+O to expand and collapse blocks of content.',
type: TransientMessageType.Warning,
});
return true;
}

View File

@@ -344,11 +344,12 @@ describe('keyMatchers', () => {
},
{
command: Command.SHOW_MORE_LINES,
positive: [
positive: [createKey('o', { ctrl: true })],
negative: [
createKey('s', { ctrl: true }),
createKey('o', { ctrl: true }),
createKey('s'),
createKey('l', { ctrl: true }),
],
negative: [createKey('s'), createKey('l', { ctrl: true })],
},
// Shell commands