-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Paste multi-line #191
Comments
Thank you for the bug report. I've been unable to reproduce this on my system so far. May I ask the following questions, just so I can further investigate:
I have the following theories
Hopefully I can reproduce this bug, rule these out one by one and find and fix the root cause |
Answering the easy ones first:
I use iTerm2, and the (old, basic) RubyMine terminal, and I run
I also use oh-my-zsh, and powerline 10k, a zsh theme: https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#oh-my-zsh. Note: The key bindings suggested by the ox runtime are often incorrect / confusing, as suggestions are usually uppercase, but only work when lower case. (e.g. Also of note, I generally use the standard MacOS keybinding for paste, |
Thanks for your response, I'm pretty confident this is something to do with macOS input, I'll fire up my test machine and get debugging. Hopefully this can get patched ready for the next release! |
Also, FWIW, I'm on the latest MacOS, Sequoia 15.2. I have tried bouncing the copied text through a basic GUI text editor (like Smultron, or Text Edit), pasting it there, and recopying, just to be sure it isn't an artifact from the source of the copy. It has not made any difference. |
I can reproduce this problem in Windows Terminal.
Both terminals correctly cut multi-line text with Ctrl+x. I checked the clipboard history. It occurs with every text. Both of LF/CRLF.
to
|
@kachick Thank you for the info. I think I have managed to reproduce this on my windows machine in windows terminal. In Alacritty: when I copy some text with newlines from an external editor (notepad++) , it pastes in perfectly. The only time it starts removing newlines is when I copy and paste within Ox itself. Very strange behaviour. I'll look into this. |
It may be worth looking into what |
I think vim might interact with the system's clipboard directly whereas Ox just piggybacks on the terminal emulator feeding it the paste text. I originally added vim-style clipboard management, but it was removed because it was quite heavy and didn't work over SSH. @pboling @kachick do you happen to get a warning message immediately after pasting text with newlines that says something like |
I haven't seen that on Mac, no. |
Ok, so I might have found the error. Ox always enables something called bracketed paste, which helps speed up pasting and prevents weird behaviour. Not all terminals support bracketed paste, but strangely, when alacritty on windows doesn't support it, and it is enabled, it messes with pasted Luckily, when I don't enable bracketed paste on alacritty, I'll open an issue in the If that doesn't lead to anything I might be able to work out a way to intelligently switch it off if it detects it isn't working, thus restoring normal paste behaviour on systems where bracketed paste is not supported. |
On further research, I found some existing issues that are related to this: This one indicates that some terminals send This one hints at the issue I discovered in my previous comment - windows doesn't support it at all anyway, so it might as well be completely disabled on windows: So there might be 2 different issues at play here. Very interesting. So I will implement 2 fixes:
hopefully these work? |
Issue opened here crossterm-rs/crossterm#962 |
Looking forward to testing it out! |
Thank you for the ⚡ quick fix! |
https://formulae.brew.sh/formula/ox Update:
|
Working for me! I can paste multi-line. |
Fantastic news! 🎉 Thank you to you both for your help. Happy editing! |
What is the bug?
Unable to paste text that has new lines.
What did you do to get the bug?
Copy text with new lines... such as this random example:
And attempt to paste into ox.
What behaviour were you expecting?
I expect the paste to not strip new lines.
Screenshots (if applicable)
The text was updated successfully, but these errors were encountered: