diff options
| author | Tom Dalziel <tom_dl@hotmail.com> | 2021-12-12 23:12:04 +0000 |
|---|---|---|
| committer | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2021-12-19 18:29:22 +0100 |
| commit | dd13874ff759ece05cbe47d10549c25ee86bff2f (patch) | |
| tree | 952ab3069136af61fb36ddd9c19a921e1df70c52 /evil-states.el | |
| parent | a1f623c3eb12ecf42ad4b1665a7fde7e30451320 (diff) | |
Replace state pasting
Diffstat (limited to 'evil-states.el')
| -rw-r--r-- | evil-states.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/evil-states.el b/evil-states.el index d9784b5..0e3b9e9 100644 --- a/evil-states.el +++ b/evil-states.el @@ -905,15 +905,16 @@ CORNER defaults to `upper-left'." (when char (insert char)))))) -(defun evil-update-replace-alist (opoint count chars-to-delete) +(defun evil-update-replace-alist (opoint count chars-to-delete &optional offset) "Add CHARS-TO-DELETE chars to evil-replace-alist, starting at OPOINT. -If COUNT is greater than CHARS-TO-DELETE, pad the alist with nils." +If COUNT is greater than CHARS-TO-DELETE, pad the alist with nils. +Decrement recorded position by optional offset, or 0." (when (evil-replace-state-p) (dotimes (c count) (let ((pos (+ c opoint))) (add-to-list 'evil-replace-alist - (cons pos (when (< c chars-to-delete) - (char-after pos)))))))) + (cons (- pos (or offset 0)) (when (< c chars-to-delete) + (char-after pos)))))))) ;;; Motion state |
