fix: 降低 paste 检测阈值,修复非 bracketed-paste 终端粘贴文本损坏

非 bracketed-paste 终端下,短粘贴(<800 chars)的 stdin chunk 作为独立
keystroke 走 useTextInput.onInput 路径,闭包中 cursor 未刷新导致多次插入
竞态。现将 ≥3 字符的非特殊键输入纳入 paste 累积模式,绕过逐 chunk 处理。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
psj88520 2026-05-13 08:12:20 +08:00
parent 2bca31e525
commit 7f34ab6ae6

View File

@ -255,7 +255,15 @@ export function usePasteHandler({
(input.length > PASTE_THRESHOLD || (input.length > PASTE_THRESHOLD ||
pastePendingRef.current || pastePendingRef.current ||
hasImageFilePath || hasImageFilePath ||
isFromPaste) isFromPaste ||
(input.length >= 3 &&
!key.return &&
!key.tab &&
!key.escape &&
!key.upArrow &&
!key.downArrow &&
!key.leftArrow &&
!key.rightArrow))
if (shouldHandleAsPaste) { if (shouldHandleAsPaste) {
pastePendingRef.current = true pastePendingRef.current = true