mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 22:44:45 -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', () => {
|
describe('Fast return buffering', () => {
|
||||||
|
|||||||
@@ -524,9 +524,9 @@ function* emitKeys(
|
|||||||
// carriage return
|
// carriage return
|
||||||
name = 'return';
|
name = 'return';
|
||||||
meta = escaped;
|
meta = escaped;
|
||||||
} else if (ch === '\n') {
|
} else if (escaped && ch === '\n') {
|
||||||
// Enter, should have been called linefeed
|
// Alt+Enter (linefeed), should be consistent with carriage return
|
||||||
name = 'enter';
|
name = 'return';
|
||||||
meta = escaped;
|
meta = escaped;
|
||||||
} else if (ch === '\t') {
|
} else if (ch === '\t') {
|
||||||
// tab
|
// tab
|
||||||
|
|||||||
Reference in New Issue
Block a user