[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil c59f2c09c6: gp & gP linewise & blockwise
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil c59f2c09c6: gp & gP linewise & blockwise |
Date: |
Fri, 4 Nov 2022 20:58:40 -0400 (EDT) |
branch: elpa/evil
commit c59f2c09c63de5f001c19f8513a19dfc72858e75
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
gp & gP linewise & blockwise
---
evil-commands.el | 22 ++++++++++++++++------
evil-common.el | 13 ++++++++-----
evil-tests.el | 11 ++++++++++-
evil-vars.el | 3 +++
4 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/evil-commands.el b/evil-commands.el
index fca933be18..57dc58bf19 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2206,6 +2206,11 @@ The return value is the yanked text."
(when (and evil-move-cursor-back
(> (length text) 0))
(backward-char))))
+ (when evil--cursor-after
+ (if (eq 'evil-yank-line-handler yank-handler)
+ (ignore-errors (evil-next-line-first-non-blank 1))
+ (evil-forward-char 1 nil t))
+ (setq evil--cursor-after nil))
;; no paste-pop after pasting from a register
(when register
(setq evil-last-paste nil))
@@ -2258,6 +2263,11 @@ The return value is the yanked text."
(evil-set-marker ?\] (1- (point)))
(when (evil-normal-state-p)
(evil-move-cursor-back)))))
+ (when evil--cursor-after
+ (if (eq 'evil-yank-line-handler yank-handler)
+ (ignore-errors (evil-next-line-first-non-blank 1))
+ (evil-forward-char 1 nil t))
+ (setq evil--cursor-after nil))
(when register
(setq evil-last-paste nil))
(and (> (length text) 0) text)))))
@@ -2268,9 +2278,9 @@ The return value is the yanked text."
leave the cursor just after the new text."
:suppress-operator t
(interactive "*P<x>")
- (setq count (prefix-numeric-value count))
- (evil-paste-before count register yank-handler)
- (evil-forward-char 1 nil t))
+ (setq count (prefix-numeric-value count)
+ evil--cursor-after t)
+ (evil-paste-before count register yank-handler))
(evil-define-command evil-paste-after-cursor-after
(count &optional register yank-handler)
@@ -2278,9 +2288,9 @@ leave the cursor just after the new text."
leave the cursor just after the new text."
:suppress-operator t
(interactive "*P<x>")
- (setq count (prefix-numeric-value count))
- (evil-paste-after count register yank-handler)
- (evil-forward-char 1 nil t))
+ (setq count (prefix-numeric-value count)
+ evil--cursor-after t)
+ (evil-paste-after count register yank-handler))
(defun evil-insert-for-yank-at-col (startcol _endcol string count)
"Insert STRING at STARTCOL."
diff --git a/evil-common.el b/evil-common.el
index 349deff15a..ba9f1374dc 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -2687,7 +2687,8 @@ The tracked insertion is set to `evil-last-insertion'."
(mark t)
(point)))
(evil-move-mark (1+ (mark t)))
- (evil-exchange-point-and-mark)
+ (unless evil--cursor-after
+ (evil-exchange-point-and-mark))
(back-to-indentation))
(t
(insert text)))))
@@ -2738,10 +2739,12 @@ The tracked insertion is set to `evil-last-insertion'."
(* count (length (car lines))))) ; number of colums
(evil-set-marker ?\[ opoint)
(evil-set-marker ?\] (1- epoint))
- (goto-char opoint)
- (when (and (eq this-command 'evil-paste-after)
- (not (eolp)))
- (forward-char))))
+ (if evil--cursor-after
+ (goto-char (1- epoint))
+ (goto-char opoint)
+ (when (and (eq this-command 'evil-paste-after)
+ (not (eolp)))
+ (forward-char)))))
(defun evil-delete-yanked-rectangle (nrows ncols)
"Special function to delete the block yanked by a previous paste command.
diff --git a/evil-tests.el b/evil-tests.el
index 2e069af49d..276eb7b3a8 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -3154,7 +3154,16 @@ word3[]"))
("2F " "gP")
"alphaalpha[ ]bravo alphacharlie"
("l" "ve" "gp")
- "alphaalpha alpha[ ]alphacharlie")))
+ "alphaalpha alpha[ ]alphacharlie"))
+ (ert-info ("gp linewise")
+ (evil-test-buffer
+ "[a]lpha line\nbravo line\ncharlie line\ndelta line\necho line"
+ ("2yy" "2j")
+ "alpha line\nbravo line\n[c]harlie line\ndelta line\necho line"
+ ("gp")
+ "alpha line\nbravo line\ncharlie line\nalpha line\nbravo line\n[d]elta
line\necho line"
+ (".")
+ "alpha line\nbravo line\ncharlie line\nalpha line\nbravo line\ndelta
line\nalpha line\nbravo line\necho line")))
(ert-deftest evil-test-ex-put ()
"evil-ex-put inserts text linewise, regardless of yank-handler"
diff --git a/evil-vars.el b/evil-vars.el
index 74aeb518e1..c8ec51a866 100644
--- a/evil-vars.el
+++ b/evil-vars.el
@@ -1683,6 +1683,9 @@ not deleted and not yanked to a specific register.")
(defvar evil-paste-count nil
"The count argument of the current paste command.")
+(defvar evil--cursor-after nil
+ "Internal flag for gp & gP.")
+
(defvar evil-temporary-undo nil
"When undo is disabled in current buffer.
Certain commands depending on undo use this variable
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil c59f2c09c6: gp & gP linewise & blockwise,
ELPA Syncer <=