-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Pasting clipboard duplicates newlines #5528
Comments
Does not repro for me with the following steps:
as expected. How are you getting your multiline string into the clipboard? |
Your example does not reproduce it for me. However it does, if I copy my string from the browser (Firefox on X11) either by select and Ctrl+C or by clicking the nearby copy icon:
Apparently it than comes with a Windows style newline:
but it somehow depends on what is running in the terminal. When pasting into running
|
I cannot reproduce this, there is no difference compared to 0.25.2.
Then the problem you are experiencing is obviously related to how some software copies text to the clipboard.
When you paste in a modern shell, bracketed paste mode will be used and the data will be passed to the program by the escape sequence as is. When bracketed paste mode is not enabled, kitty will convert CR LF to LF, then convert LF to CR. From my understanding, you want to run |
It was because GTK converts line endings to DOS line ending for text/plain but not for text/plain;charset=utf-8. Because of the clipboard handling re-organisation to support arbitrary mime types in the the last release, kitty started requesting text/plain instead of UTF8_STRING under X11 which caused this issue. Have special cased text/plain to now request text/plain;charset=utf-8 first. |
Thank you! What a stupid reason... |
Hi, I still have this issue on Kitty 0.26.5, when using X11 (i3). I don't replicate this on Wayland (sway/wlroots). To reproduce, I'm copying a string with two lines from leafpad (a GTK+2 application) and it adds a blank line in the middle. I'm running Arch Linux, it is up-to-date (I can give some specific dependency versions if required). |
That is because leafpad is using DOS line endings even for Esily verified by running xclip -o -t text/plain;charset=utf-8 -selection clipboard | python -c "import sys; print(sys.stdin.buffer.read())" That's a bug in leafpad (or more likely the version of GTK it is using). |
Leafpad development is pretty much dead (last version from 2020), so I don't think anything will come from it. I use it for temporary notes on my screen, because I consider it stable (I know nothing will change). I now hesitate between:
Thanks for your answer anyway. |
@Exagone313 here you go: 5849716 There was another use case that benefits from trying UTF8_STRING first, so I made the change. |
Describe the bug
Since 0.26.3 pasting from the clipboard duplicates newlines in some shells and vim. It does not happen on 0.26.2.
To Reproduce
Steps to reproduce the behavior:
paste_from_clipboard
): the newline is duplicated in zsh and vim, not in shScreenshots
If applicable, add screenshots to help explain your problem.
Environment details
Additional context
I can reproduce the problem with
kitty --config NONE
and with plain zsh (zsh -f -i
).The text was updated successfully, but these errors were encountered: