feat(cli): Add support for Ctrl+Backspace to delete a word backward (#7162)

This commit is contained in:
David East
2025-09-02 21:00:41 -04:00
committed by GitHub
parent edb346d4ed
commit 4d07cb7dba
6 changed files with 196 additions and 71 deletions

View File

@@ -346,6 +346,25 @@ describe('KeypressContext - Kitty Protocol', () => {
}),
);
});
it('should recognize Ctrl+Backspace in kitty protocol', async () => {
const keyHandler = vi.fn();
const { result } = renderHook(() => useKeypressContext(), { wrapper });
act(() => result.current.subscribe(keyHandler));
// Modifier 5 is Ctrl
act(() => {
stdin.sendKittySequence(`\x1b[127;5u`);
});
expect(keyHandler).toHaveBeenCalledWith(
expect.objectContaining({
name: 'backspace',
kittyProtocol: true,
ctrl: true,
}),
);
});
});
describe('paste mode', () => {