mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
Support command/ctrl/alt backspace correctly (#17175)
This commit is contained in:
committed by
GitHub
parent
e894871afc
commit
f190b87223
@@ -154,9 +154,10 @@ function formatBindings(bindings: readonly KeyBinding[]): string[] {
|
||||
|
||||
function formatBinding(binding: KeyBinding): string {
|
||||
const modifiers: string[] = [];
|
||||
if (binding.ctrl) modifiers.push('Ctrl');
|
||||
if (binding.command) modifiers.push('Cmd');
|
||||
if (binding.shift) modifiers.push('Shift');
|
||||
if (binding.alt) modifiers.push('Alt');
|
||||
if (binding.ctrl) modifiers.push('Ctrl');
|
||||
if (binding.cmd) modifiers.push('Cmd');
|
||||
|
||||
const keyName = formatKeyName(binding.key);
|
||||
if (!keyName) {
|
||||
@@ -167,12 +168,13 @@ function formatBinding(binding: KeyBinding): string {
|
||||
let combo = segments.join(' + ');
|
||||
|
||||
const restrictions: string[] = [];
|
||||
if (binding.ctrl === false) restrictions.push('no Ctrl');
|
||||
if (binding.shift === false) restrictions.push('no Shift');
|
||||
if (binding.command === false) restrictions.push('no Cmd');
|
||||
if (binding.shift === false) restrictions.push('Shift');
|
||||
if (binding.alt === false) restrictions.push('Alt');
|
||||
if (binding.ctrl === false) restrictions.push('Ctrl');
|
||||
if (binding.cmd === false) restrictions.push('Cmd');
|
||||
|
||||
if (restrictions.length > 0) {
|
||||
combo = `${combo} (${restrictions.join(', ')})`;
|
||||
combo = `${combo} (no ${restrictions.join(', ')})`;
|
||||
}
|
||||
|
||||
return combo ? `\`${combo}\`` : '';
|
||||
|
||||
@@ -36,7 +36,7 @@ describe('generate-keybindings-doc', () => {
|
||||
},
|
||||
{
|
||||
description: 'Submit with Enter if no modifiers are held.',
|
||||
bindings: [{ key: 'return', ctrl: false, shift: false }],
|
||||
bindings: [{ key: 'return', shift: false, ctrl: false }],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -47,7 +47,7 @@ describe('generate-keybindings-doc', () => {
|
||||
description: 'Move up through results.',
|
||||
bindings: [
|
||||
{ key: 'up', shift: false },
|
||||
{ key: 'p', ctrl: true, shift: false },
|
||||
{ key: 'p', shift: false, ctrl: true },
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -59,7 +59,7 @@ describe('generate-keybindings-doc', () => {
|
||||
expect(markdown).toContain('Trigger custom action.');
|
||||
expect(markdown).toContain('`Ctrl + X`');
|
||||
expect(markdown).toContain('Submit with Enter if no modifiers are held.');
|
||||
expect(markdown).toContain('`Enter (no Ctrl, no Shift)`');
|
||||
expect(markdown).toContain('`Enter (no Shift, Ctrl)`');
|
||||
expect(markdown).toContain('#### Navigation');
|
||||
expect(markdown).toContain('Move up through results.');
|
||||
expect(markdown).toContain('`Up Arrow (no Shift)`');
|
||||
|
||||
Reference in New Issue
Block a user