editor: Use a single newline between each copied line from a multi-cursor selection#41204
Conversation
a83b36e to
0bdb5f2
Compare
0bdb5f2 to
7728370
Compare
|
One problem that I'm noticing with this change:
|
|
I've posted a fix to the crash, but the code itself is not worthy to be merged 😄 But here's my notes on what I've found when digging through the code for
That all being said, I'm wondering what the best approach would be to resolve this issue.
|
SomeoneToIgnore
left a comment
There was a problem hiding this comment.
That's quite an investigation for such small change, thank you for checking on all this!
Logically, it seems that we should fix the receiving end too: we should copy into the buffer the "right" text already, as the user might want to paste elsewhere, and unintuitive extra newlines would be there if not trimmed.
As a bonus, something similar happens on the Vim emulation side?
zed/crates/vim/src/normal/paste.rs
Lines 103 to 114 in 5e41ce1
I would start with test(s): as you have a way to reproduce this and it's a panic.
Not sure I can help more, as there's no specific about the panic per se — removing +1 seems logical.
…ti-cursor selection
…e-line selections in clipboard
1540cc3 to
492b1be
Compare
|
@SomeoneToIgnore thanks for the feedback! I've pushed up another change that handles the editor commands for Cut, Copy, and Paste. I've also revised the tests based on your suggestions, and added a new test for the Cut command. I've started looking into the Vim commands too, since it seems they also add an extra newline between multi-cursor selections of entire lines (using visual mode with line selection). Should I continue to make more changes in this PR for the Vim commands? |
|
Thank you for the fix, this looks good as the first glance, but I hope for @ConradIrwin to check the Vim part first to see what should we do about it. |
|
Thanks for the offer! If you'd like to make the same changes to vim mode, happy to accept a second PR, but no need to block on that. I also don't think it's super urgent as I haven't (yet) had any complaints about this – vim users are a little less likely to use multi-cursor actions like this) |
…rsor selection (zed-industries#41204) Closes zed-industries#40923 Release Notes: - Fixed the amount of newlines between copied lines from a multi-cursor selection of multiple full-line copies. --- https://github.com/user-attachments/assets/ab7474d6-0e49-4c29-9700-7692cd019cef
Closes #40923
Release Notes:
Zed-Multi-Selection-Line-Copy.mp4