Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bracketed paste events #74

Merged
merged 3 commits into from
Feb 10, 2025
Merged

Support bracketed paste events #74

merged 3 commits into from
Feb 10, 2025

Conversation

stefanhaller
Copy link
Collaborator

Reviewed as part of jesseduffield/lazygit#4234.

Recognize bracketed paste events, and set a flag on Gui if a paste is active.
Application code can use this to handle carriage returns or tabs differently
when they come from a paste operation.
When pasting, Ghostty seems to convert all \n to \r for some reason. Convert
them back to \n so that we can handle them normally.

I have to admit that I'm confused as to why this is necessary. From what I
understand from Ghostty's source code (e.g.
ghostty-org/ghostty@010338354a0) it does this
conversion only for non-bracketed paste mode, but I'm seeing it in bracketed
paste mode, and it is only there that we convert it back.
My assumption is that pressing command-V on a non-editable view is always a
mistake; it would execute arbitrary commands depending on what's in the
clipboard, so prevent it.
@stefanhaller stefanhaller merged commit aba68ae into master Feb 10, 2025
1 check passed
@stefanhaller stefanhaller deleted the bracketed-paste branch February 10, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant