emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil 6ca32ca05e: Fix pasting charwise text onto linewise s


From: ELPA Syncer
Subject: [nongnu] elpa/evil 6ca32ca05e: Fix pasting charwise text onto linewise selection
Date: Thu, 4 Jan 2024 07:00:06 -0500 (EST)

branch: elpa/evil
commit 6ca32ca05eef41c3bc3d9cc66fc052741250bc3a
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>

    Fix pasting charwise text onto linewise selection
---
 evil-commands.el | 5 +++++
 evil-tests.el    | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index 21a2527cae..286cf9465a 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)
diff --git a/evil-tests.el b/evil-tests.el
index 84a779e28a..09569f1574 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -3081,7 +3081,7 @@ word3[]"))
       ("yiwyywyiw^j")
       "word1a word1b word1c\n[w]ord2a word2b\nword3a word3b word3c word3d\n"
       ("Vp")
-      "word1a word1b word1c\nword1[b]word3a word3b word3c word3d\n"))
+      "word1a word1b word1c\nword1[b]\nword3a word3b word3c word3d\n"))
   (ert-info ("Visual-line paste, char paste, line pop")
     (evil-test-buffer
       "[w]ord1a word1b word1c\nword2a word2b\nword3a word3b word3c word3d\n"
@@ -3095,7 +3095,7 @@ word3[]"))
       ("yiwyywyiw^j")
       "word1a word1b word1c\n[w]ord2a word2b\nword3a word3b word3c word3d\n"
       ("Vp\C-p\C-p")
-      "word1a word1b word1c\nword1[a]word3a word3b word3c word3d\n")))
+      "word1a word1b word1c\nword1[a]\nword3a word3b word3c word3d\n")))
 
 (ert-deftest evil-test-register ()
   "Test yanking and pasting to and from register."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]