diff options
author | Nathan Vegdahl | 2021-07-20 17:56:27 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-20 17:56:27 +0000 |
commit | e8a3980e464a9c98c3f76cada6c46a66498dc2bf (patch) | |
tree | 325d5f473236c303ccc42e0666f3ef8618f4999e /helix-term | |
parent | 1910fa77235de8e85c39ea2f390af243f18dfc81 (diff) |
Fix line-wise `p` pasting before the current line instead of after.
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/commands.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 5964e354..61c5096d 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3093,7 +3093,10 @@ fn paste_impl( // paste linewise before (Paste::Before, true) => text.line_to_char(text.char_to_line(range.from())), // paste linewise after - (Paste::After, true) => text.line_to_char(text.char_to_line(range.to())), + (Paste::After, true) => { + let idx = range.to().saturating_sub(1).max(range.from()); + text.line_to_char((text.char_to_line(idx) + 1).min(text.len_lines())) + } // paste insert (Paste::Before, false) => range.from(), // paste append |