Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't mutate register when stripping test props during paste #1896

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -2249,9 +2249,10 @@ The return value is the yanked text."
(let ((evil-kill-on-visual-paste (not evil-kill-on-visual-paste)))
(evil-visual-paste count register))
(evil-with-undo
(let* ((text (if register
(evil-get-register register)
(current-kill 0)))
(let* ((text (copy-sequence
(if register
(evil-get-register register)
(current-kill 0))))
(yank-handler (or yank-handler
(when (stringp text)
(car-safe (get-text-property
Expand Down Expand Up @@ -2305,9 +2306,10 @@ The return value is the yanked text."
(if (evil-visual-state-p)
(evil-visual-paste count register)
(evil-with-undo
(let* ((text (if register
(evil-get-register register)
(current-kill 0)))
(let* ((text (copy-sequence
(if register
(evil-get-register register)
(current-kill 0))))
(yank-handler (or yank-handler
(when (stringp text)
(car-safe (get-text-property
Expand Down
12 changes: 11 additions & 1 deletion evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -2750,7 +2750,17 @@ This bufferThis bufferThis buffe[r];; and for Lisp evaluation."))
("p")
";; This buffer is for notes you don't want to save.[;];
;; If you want to create a file, visit that file wi;; th C-x C-f,
;; then enter the text in that file's own buffer. ;;")))
;; then enter the text in that file's own buffer. ;;"))
(ert-info ("Don't mutate register when stripping test props")
(let (indent-tabs-mode)
(evil-test-buffer
"[a]aaaaaaaaaaaa
bbbbbbbb
cccc"
("\C-vG$yA " "\C-r\"" [escape] "up")
"aaaaaaaaaaaaa[a]aaaaaaaaaaaa
bbbbbbbb bbbbbbbb
cccc cccc"))))

(ert-deftest evil-test-paste-after ()
"Test `evil-paste-after'"
Expand Down