mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-11 06:31:01 -07:00
fix(cli): resolve Ctrl+Enter and Ctrl+J newline issues (#17021)
This commit is contained in:
@@ -154,6 +154,36 @@ describe('KeypressContext', () => {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
it('should recognize \n (LF) as ctrl+j', async () => {
|
||||
const { keyHandler } = setupKeypressTest();
|
||||
|
||||
act(() => stdin.write('\n'));
|
||||
|
||||
expect(keyHandler).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
name: 'j',
|
||||
ctrl: true,
|
||||
meta: false,
|
||||
shift: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should recognize \\x1b\\n as Alt+Enter (return with meta)', async () => {
|
||||
const { keyHandler } = setupKeypressTest();
|
||||
|
||||
act(() => stdin.write('\x1b\n'));
|
||||
|
||||
expect(keyHandler).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
name: 'return',
|
||||
ctrl: false,
|
||||
meta: true,
|
||||
shift: false,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Fast return buffering', () => {
|
||||
|
||||
@@ -524,9 +524,9 @@ function* emitKeys(
|
||||
// carriage return
|
||||
name = 'return';
|
||||
meta = escaped;
|
||||
} else if (ch === '\n') {
|
||||
// Enter, should have been called linefeed
|
||||
name = 'enter';
|
||||
} else if (escaped && ch === '\n') {
|
||||
// Alt+Enter (linefeed), should be consistent with carriage return
|
||||
name = 'return';
|
||||
meta = escaped;
|
||||
} else if (ch === '\t') {
|
||||
// tab
|
||||
|
||||
Reference in New Issue
Block a user