Fix an interaction between vim's linewise yank and editor's paste (#33555)
Closes #32397 This PR fixes an issue when pasting text with the `editor::Paste` command that was copied with `vim::Yank`'s linewise selection. The change stops setting the `is_entire_line` setting when copying from with vim linewise selections (<kbd>⇧v</kbd>) and motions (i.e. <kbd>y2j</kbd>). This flag is used when cutting/copying text without being selected (so, place a cursor on line without selecting anything, and press <kbd>⌘X</kbd>). When cutting/copying text in this manner, [the editor pastes the text above the cursor](36941253ee/crates/editor/src/editor.rs (L11936-L11947)
). However, this behaviour is not needed when cutting/copying with vim motions. Pasting with vim operations is not affected by this change. [They are handled elsewhere](36941253ee/crates/vim/src/normal/paste.rs
) and they don't consider the `is_entire_line` flag at all. Note for maintainers: I'm not familiar with this codebase 🙃. This change fixes the issue. I don't see anything breaking... but let me know if it's not the case and a more thorough change is needed. **Before:** The text is copied above the first line, before the cursor. https://github.com/user-attachments/assets/0c2f111a-5da0-4775-a7a0-2e4fb6f78bfc **After:** The text is copied at the cursor location: https://github.com/user-attachments/assets/60a17985-fe8b-4149-a77b-d72bf531bf85 Release Notes: - Fixed an issue when pasting text that was yanked with vim's linewise selections.
This commit is contained in:
parent
d10cc13924
commit
b0086b472f
1 changed files with 1 additions and 1 deletions
|
@ -196,7 +196,7 @@ impl Vim {
|
|||
}
|
||||
clipboard_selections.push(ClipboardSelection {
|
||||
len: text.len() - initial_len,
|
||||
is_entire_line: kind.linewise(),
|
||||
is_entire_line: false,
|
||||
first_line_indent: buffer.indent_size_for_line(MultiBufferRow(start.row)).len,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue