@@ -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