fix(cli): treat CRLF as paste in passthrough mode#1456
Conversation
cdf94fc to
ba0f6ad
Compare
|
Follow-up: keep the non-bracketed paste heuristic CR-only (same as before) and keep the change scoped to treating standalone CRLF chunks as paste events. |
|
@liqiongyuThanks for your PR! Copy-paste behavior on Windows can be quite subtle, and we’ve previously spent a fair amount of time trying to debug similar issues. To make sure we handle this correctly, could you confirm whether you’re able to reliably reproduce the issue? If so, it would be really helpful if you could share clear and reliable reproduction steps. Thanks a lot for your help! |
|
Thanks for the careful check! I don’t have a Windows machine available at the moment, so I can’t personally confirm reproduction in Windows Terminal/PowerShell. That said, the bug is specific to stdin passthrough mode on Windows: during multiline paste, some terminals can emit a standalone CRLF chunk ( Repro suggestion (Windows 10/11, Windows Terminal + PowerShell):
$txt = (1..5000 | ForEach-Object { "line$_" }) -join "`r`n"
Set-Clipboard -Value $txt
Expected: content is inserted (with newlines) without submitting mid-paste. I also added a regression test that simulates exactly this input chunk: If you (or someone on Windows) can run the above steps and confirm, that’d be great — happy to adjust if you observe different behavior. |
|
@liqiongyu Understood. I prefer not to merge this PR until we can reproduce the issue and confirm that it is indeed the root cause. That said, we’ll keep an eye on it and revisit if similar issues come up in the future. |
|
This pull request has had no activity for 60 days and is being marked as stale. It will be closed in another 30 days if no further activity occurs. To keep it open, push a new commit or leave a comment. Maintainers may apply |
Fixes #299.
Windows paste workaround (stdin passthrough) can receive a standalone CRLF chunk during multiline paste. Treating it as a normal return can trigger submit and break pasting.
Changes:
as a paste event in passthrough mode.Tests:
npx vitest packages/cli/src/ui/contexts/KeypressContext.test.tsx --run