From 6dad6b7f31fd78cc7941361f3cdd8a68b9c79e5d Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Mon, 15 Sep 2025 16:03:51 +0800 Subject: [PATCH] fix: test fix --- packages/cli/src/ui/contexts/KeypressContext.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/cli/src/ui/contexts/KeypressContext.tsx b/packages/cli/src/ui/contexts/KeypressContext.tsx index d676ce6b..0b910bc9 100644 --- a/packages/cli/src/ui/contexts/KeypressContext.tsx +++ b/packages/cli/src/ui/contexts/KeypressContext.tsx @@ -98,8 +98,14 @@ export function KeypressProvider({ const keypressStream = new PassThrough(); let usePassthrough = false; const nodeMajorVersion = parseInt(process.versions.node.split('.')[0], 10); + const isWindows = process.platform === 'win32'; + // On Windows, Node's readline keypress stream often loses bracketed paste + // boundaries, causing multi-line pastes to be delivered as plain Return + // key events. This leads to accidental submits on Enter within pasted text. + // Force passthrough on Windows to parse raw bytes and detect ESC[200~...201~. if ( nodeMajorVersion < 20 || + isWindows || process.env['PASTE_WORKAROUND'] === '1' || process.env['PASTE_WORKAROUND'] === 'true' ) {