mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-01 05:00:46 +00:00
strip escape characters when pasting. (#386)
This commit is contained in:
parent
1728bf3f44
commit
8b959c2060
4 changed files with 19 additions and 3 deletions
|
|
@ -495,6 +495,14 @@ describe('useTextBuffer', () => {
|
|||
act(() => result.current.handleInput(undefined, { rightArrow: true })); // cursor [0,2]
|
||||
expect(getBufferState(result).cursor).toEqual([0, 2]);
|
||||
});
|
||||
|
||||
it('should strip ANSI escape codes when pasting text', () => {
|
||||
const { result } = renderHook(() => useTextBuffer({ viewport }));
|
||||
const textWithAnsi = '\x1B[31mHello\x1B[0m \x1B[32mWorld\x1B[0m';
|
||||
// Simulate pasting by calling handleInput with a string longer than 1 char
|
||||
act(() => result.current.handleInput(textWithAnsi, {}));
|
||||
expect(getBufferState(result).text).toBe('Hello World');
|
||||
});
|
||||
});
|
||||
|
||||
// More tests would be needed for:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue