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

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

[nongnu] elpa/evil-goggles 4388040c0c 034/225: Check early for non-nil `


From: ELPA Syncer
Subject: [nongnu] elpa/evil-goggles 4388040c0c 034/225: Check early for non-nil `evil-last-paste'
Date: Wed, 12 Jan 2022 08:58:40 -0500 (EST)

branch: elpa/evil-goggles
commit 4388040c0c1395fbf867d29f8441ba9405505bec
Author: Evgeni Kolev <evgenysw@gmail.com>
Commit: Evgeni Kolev <evgenysw@gmail.com>

    Check early for non-nil `evil-last-paste'
---
 evil-goggles.el           | 10 +++++-----
 test/evil-goggles-test.el | 10 ++++++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/evil-goggles.el b/evil-goggles.el
index c9acd1fa45..321382dac5 100644
--- a/evil-goggles.el
+++ b/evil-goggles.el
@@ -263,11 +263,11 @@ COUNT REGISTER YANK-HANDLER are the arguments of the 
original function."
 ADVICED-FUN is used to lookup the face for the overlay.
 The overlay region is derermined by evil's variable `evil-last-paste'"
   (unless evil-goggles--on
-    (let* ((beg (nth 3 evil-last-paste))
-           (end (nth 4 evil-last-paste))
-           (is-beg-at-eol (save-excursion (goto-char beg) (eolp)))
-           (beg-corrected (if is-beg-at-eol (1+ beg) beg) ))
-      (when (and beg end)
+    (when evil-last-paste
+      (let* ((beg (nth 3 evil-last-paste))
+             (end (nth 4 evil-last-paste))
+             (is-beg-at-eol (save-excursion (goto-char beg) (eolp)))
+             (beg-corrected (if is-beg-at-eol (1+ beg) beg) ))
         (evil-goggles--show beg-corrected end (evil-goggles--face 
adviced-fun))))))
 
 (provide 'evil-goggles)
diff --git a/test/evil-goggles-test.el b/test/evil-goggles-test.el
index 7bbd9f897b..2b71a7d533 100644
--- a/test/evil-goggles-test.el
+++ b/test/evil-goggles-test.el
@@ -18,6 +18,16 @@
      (evil-delete (point-min) (point-max))
      "")))
 
+(ert-deftest evil-test-last-insert-register ()
+  "Test last insertion register."
+  (evil-test-buffer
+   "[l]ine 1\n"
+   ("GiABC" [escape])
+   "line 1\nAB[C]"
+   ("gg\".P")
+   "AB[C]line 1\nABC"))
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; code below is copied from evil-tests.el
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



reply via email to

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