mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 20:50:34 +00:00
Fix bug where single line inserts were deleting all text after the in… (#1114)
This commit is contained in:
parent
11f524c125
commit
a7e45d47cd
2 changed files with 18 additions and 1 deletions
|
|
@ -173,6 +173,21 @@ describe('useTextBuffer', () => {
|
|||
expect(state.visualCursor).toEqual([0, 2]);
|
||||
});
|
||||
|
||||
it('insert: should insert text in the middle of a line', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useTextBuffer({
|
||||
initialText: 'abc',
|
||||
viewport,
|
||||
isValidPath: () => false,
|
||||
}),
|
||||
);
|
||||
act(() => result.current.move('right'));
|
||||
act(() => result.current.insert('-NEW-'));
|
||||
const state = getBufferState(result);
|
||||
expect(state.text).toBe('a-NEW-bc');
|
||||
expect(state.cursor).toEqual([0, 6]);
|
||||
});
|
||||
|
||||
it('newline: should create a new line and move cursor', () => {
|
||||
const { result } = renderHook(() =>
|
||||
useTextBuffer({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue