diff --git a/packages/cli/src/ui/contexts/KeypressContext.tsx b/packages/cli/src/ui/contexts/KeypressContext.tsx index 1d1fcbbcde..5354d66d38 100644 --- a/packages/cli/src/ui/contexts/KeypressContext.tsx +++ b/packages/cli/src/ui/contexts/KeypressContext.tsx @@ -593,16 +593,8 @@ export function KeypressProvider({ } stdin.on('data', dataListener); - return () => { - // flush buffers by sending null key - backslashBufferer(null); - pasteBufferer(null); - // flush by sending empty string to the data listener - dataListener(''); stdin.removeListener('data', dataListener); - - // Restore the terminal to its original state. if (wasRaw === false) { setRawMode(false); } diff --git a/packages/cli/src/ui/hooks/useKeypress.test.tsx b/packages/cli/src/ui/hooks/useKeypress.test.tsx index 6a063f35fc..ebbc5eef82 100644 --- a/packages/cli/src/ui/hooks/useKeypress.test.tsx +++ b/packages/cli/src/ui/hooks/useKeypress.test.tsx @@ -262,29 +262,5 @@ describe(`useKeypress`, () => { expect(onKeypress).toHaveBeenCalledTimes(3); }); - - it('should emit partial paste content if unmounted mid-paste', () => { - const { unmount } = renderKeypressHook(true); - const pasteText = 'incomplete paste'; - - act(() => stdin.write(PASTE_START + pasteText)); - - // No event should be fired yet. - expect(onKeypress).not.toHaveBeenCalled(); - - // Unmounting should trigger the flush. - unmount(); - - expect(onKeypress).toHaveBeenCalledTimes(1); - expect(onKeypress).toHaveBeenCalledWith({ - name: '', - ctrl: false, - meta: false, - shift: false, - paste: true, - insertable: true, - sequence: pasteText, - }); - }); }); });