mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-11 22:51:00 -07:00
fix(cli): fix newline support broken in previous PR (#17159)
This commit is contained in:
committed by
GitHub
parent
211d2c5fdd
commit
aceb06a587
@@ -1096,6 +1096,23 @@ describe('useTextBuffer', () => {
|
||||
expect(getBufferState(result).lines).toEqual(['', '']);
|
||||
});
|
||||
|
||||
it('should handle Ctrl+J as newline', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useTextBuffer({ viewport, isValidPath: () => false }),
|
||||
);
|
||||
act(() =>
|
||||
result.current.handleInput({
|
||||
name: 'j',
|
||||
ctrl: true,
|
||||
meta: false,
|
||||
shift: false,
|
||||
insertable: false,
|
||||
sequence: '\n',
|
||||
}),
|
||||
);
|
||||
expect(getBufferState(result).lines).toEqual(['', '']);
|
||||
});
|
||||
|
||||
it('should do nothing for a tab key press', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useTextBuffer({ viewport, isValidPath: () => false }),
|
||||
|
||||
@@ -2292,6 +2292,7 @@ export function useTextBuffer({
|
||||
|
||||
if (key.name === 'paste') insert(input, { paste: true });
|
||||
else if (keyMatchers[Command.RETURN](key)) newline();
|
||||
else if (keyMatchers[Command.NEWLINE](key)) newline();
|
||||
else if (keyMatchers[Command.MOVE_LEFT](key)) move('left');
|
||||
else if (keyMatchers[Command.MOVE_RIGHT](key)) move('right');
|
||||
else if (keyMatchers[Command.MOVE_UP](key)) move('up');
|
||||
|
||||
Reference in New Issue
Block a user