aboutsummaryrefslogtreecommitdiff
path: root/evil-commands.el
diff options
context:
space:
mode:
authorTom Dalziel <tom_dl@hotmail.com>2024-01-04 11:59:38 +0100
committerTom Dalziel <33435574+tomdl89@users.noreply.github.com>2024-01-04 11:15:43 +0000
commit6ca32ca05eef41c3bc3d9cc66fc052741250bc3a (patch)
treeca5c82f079bd0cc1f71c69e77d5feae5a9532bcc /evil-commands.el
parent792e1d11f26b9dd7aa047d66671f38192cdace03 (diff)
Fix pasting charwise text onto linewise selection
Diffstat (limited to 'evil-commands.el')
-rw-r--r--evil-commands.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/evil-commands.el b/evil-commands.el
index 21a2527..286cf94 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2356,6 +2356,11 @@ leave the cursor just after the new text."
(setq beg evil-visual-beginning
end evil-visual-end
type (evil-visual-type))
+ ;; When pasting charwise text into linewise selection, keep trailing NL
+ (when (and text end
+ (eq 'line type)
+ (not (eq ?\n (aref text (1- (length text))))))
+ (cl-decf end))
(evil-visual-rotate 'upper-left)
(evil-delete beg end type (unless evil-kill-on-visual-paste ?_))
(when (and (eq yank-handler #'evil-yank-line-handler)