[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil 8afda6f649 3/3: Fix visual-paste-pop tests
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil 8afda6f649 3/3: Fix visual-paste-pop tests |
Date: |
Fri, 7 Jan 2022 07:58:06 -0500 (EST) |
branch: elpa/evil
commit 8afda6f6493a7f32c31d0e948e65ade06e17d1be
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Fix visual-paste-pop tests
---
evil-commands.el | 4 +++-
evil-common.el | 3 +++
evil-tests.el | 17 ++++++++++++++++-
evil-vars.el | 3 +++
4 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/evil-commands.el b/evil-commands.el
index 4055e89312..fc1d478c61 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2243,7 +2243,9 @@ The return value is the yanked text."
(when evil-kill-on-visual-paste
(current-kill -1))
;; Ensure that gv can restore visually pasted area...
- (setq evil-visual-mark (evil-get-marker ?\[ t)
+ (setq evil-visual-previous-mark evil-visual-mark
+ evil-visual-mark (evil-get-marker ?\[ t)
+ evil-visual-previous-point evil-visual-point
evil-visual-point (evil-get-marker ?\] t))
;; mark the last paste as visual-paste
(setq evil-last-paste
diff --git a/evil-common.el b/evil-common.el
index f4c882e01c..1c07d2861a 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -2764,6 +2764,9 @@ is negative this is a more recent kill."
(unless evil-last-paste
(user-error "Previous paste command used a register"))
(evil-undo-pop)
+ (when (eq last-command 'evil-visual-paste)
+ (evil-swap evil-visual-previous-mark evil-visual-mark)
+ (evil-swap evil-visual-previous-point evil-visual-point))
(goto-char (nth 2 evil-last-paste))
(setq this-command (nth 0 evil-last-paste))
;; use temporary kill-ring, so the paste cannot modify it
diff --git a/evil-tests.el b/evil-tests.el
index 28cde32296..0c56862ed5 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -7108,7 +7108,22 @@ if no previous selection")
;;[ ]>and for Lisp evaluation."
([escape] "gv")
"<;; This buffer is for notes,
-;;[ ]>and for Lisp evaluation.")))
+;;[ ]>and for Lisp evaluation.")
+ (ert-info ("After paste shifts initially selected text")
+ (evil-test-buffer
+ :visual block
+ "<1\n2\n[3]>"
+ ("yP")
+ "[1]1\n22\n33"
+ ("gvr*")
+ "[*]1\n*2\n*3")))
+ (ert-info ("Restore linewise visually-pasted selection")
+ (evil-test-buffer
+ "[a]lpha bravo\ncharlie delta
+echo foxtrot\ngolf hotel"
+ ("2yy" "++" "Vp" "gv")
+ "alpha bravo\ncharlie delta
+<alpha bravo\ncharlie delta\n>golf hotel")))
;;; Replace state
diff --git a/evil-vars.el b/evil-vars.el
index 5e2cb93b40..3887bb45f5 100644
--- a/evil-vars.el
+++ b/evil-vars.el
@@ -1654,6 +1654,9 @@ instead of `buffer-undo-list'.")
(evil-define-local-var evil-visual-point nil
"The position of point in Visual state, a marker.")
+(evil-define-local-var evil-visual-previous-point nil
+ "The position of point before Visual state, a marker.")
+
(evil-define-local-var evil-visual-mark nil
"The position of mark in Visual state, a marker.")