fix(cli): Handle VSCode Shift+Enter in text buffer

- The text buffer now correctly interprets `\\\r` (produced by Shift+Enter in the VSCode terminal) as a newline character.
- Added a corresponding test case to `text-buffer.test.ts`.

Fixes https://buganizer.corp.google.com/issues/418505364
This commit is contained in:
Taylor Mullen
2025-05-20 23:42:40 -07:00
committed by N. Taylor Mullen
parent ba7f1e1e3c
commit 7fd7c1a539
2 changed files with 13 additions and 1 deletions

View File

@@ -508,6 +508,12 @@ describe('useTextBuffer', () => {
act(() => result.current.handleInput(textWithAnsi, {}));
expect(getBufferState(result).text).toBe('Hello World');
});
it('should handle VSCode terminal Shift+Enter as newline', () => {
const { result } = renderHook(() => useTextBuffer({ viewport }));
act(() => result.current.handleInput('\r', {})); // Simulates Shift+Enter in VSCode terminal
expect(getBufferState(result).lines).toEqual(['', '']);
});
});
// More tests would be needed for: