on master help sign in
Fix line-wise `p` pasting before the current line instead of after.
commite8a3980e464a9c98c3f76cada6c46a66498dc2bf authorNathan Vegdahl <cessen@cessen.com> dateTue 20 Jul 2021, 10:56 (5 years ago) parent1910fa7
1 file changed+4−1
helix-term/src/commands.rs+4−1
helix-term/src/commands.rs+4−1
@@ -3093,7 +3093,10 @@ fn paste_impl(
30933093 // paste linewise before
30943094 (Paste::Before, true) => text.line_to_char(text.char_to_line(range.from())),
30953095 // paste linewise after
3096− (Paste::After, true) => text.line_to_char(text.char_to_line(range.to())),
3096+ (Paste::After, true) => {
3097+ let idx = range.to().saturating_sub(1).max(range.from());
3098+ text.line_to_char((text.char_to_line(idx) + 1).min(text.len_lines()))
3099+ }
30973100 // paste insert
30983101 (Paste::Before, false) => range.from(),
30993102 // paste append