fix(tui): fix Ctrl+V paste on Windows/WSL2 (#6560 and #8209) #8626
+79
−29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #6560
Complementary to #8209 which fixes image filename extraction from Windows
file copy. This PR focuses on text paste failures and PowerShell escaping issues.
Ctrl+V paste was silently failing on Windows/WSL2 for text containing file
extensions (e.g.,
image.png,c:\path\file.txt).Root cause:
Bun.file().typeinfers MIME from extension without checking if fileexists. Text like
image.pngwas treated as an image file path, failed to load,and silently dropped. Additionally, on WSL2,
clipboardyuses Linux clipboardtools which cannot access Windows clipboard.
Fix:
file.exists()check before treating pasted text as file path-EncodedCommandtoavoid quoting issues with backslash paths)
onKeyDownfor terminals withoutbracketed paste support
How did you verify your code works?
Manually tested - pasting image paths now works perfectly in windows 11 WSL2 environment.