Skip to content

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.

2 participants