mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-13 12:57:12 -07:00
fix(cli): ignore unmapped vim normal keys (#27102)
This commit is contained in:
committed by
GitHub
parent
41c9260cae
commit
5cac7c10fa
@@ -81,4 +81,24 @@ describe('useVim passthrough', () => {
|
||||
|
||||
expect(handled).toBe(false);
|
||||
});
|
||||
|
||||
it.each(['H', 'M', 'Q', 'm'])(
|
||||
'should ignore unmapped printable key %s in NORMAL mode',
|
||||
async (sequence) => {
|
||||
mockVimContext.vimMode = 'NORMAL';
|
||||
const { result } = await renderHook(() =>
|
||||
useVim(mockBuffer as TextBuffer),
|
||||
);
|
||||
|
||||
let handled = false;
|
||||
act(() => {
|
||||
handled = result.current.handleInput(
|
||||
createKey({ name: sequence, sequence, insertable: true }),
|
||||
);
|
||||
});
|
||||
|
||||
expect(handled).toBe(true);
|
||||
expect(mockBuffer.handleInput).not.toHaveBeenCalled();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1486,8 +1486,14 @@ export function useVim(buffer: TextBuffer, onSubmit?: (value: string) => void) {
|
||||
// Unknown command, clear count and pending states
|
||||
dispatch({ type: 'CLEAR_PENDING_STATES' });
|
||||
|
||||
// Ignore any Insertable key in Normal Mode
|
||||
if (normalizedKey.insertable) {
|
||||
// Ignore unmapped Insertable keys in Normal Mode, but let
|
||||
// modifier-key chords (ctrl/alt/cmd) fall through to other handlers.
|
||||
if (
|
||||
normalizedKey.insertable &&
|
||||
!normalizedKey.ctrl &&
|
||||
!normalizedKey.alt &&
|
||||
!normalizedKey.cmd
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user