Function: evil-track-last-insertion
evil-track-last-insertion is a byte-compiled function defined in
evil-common.el.
Signature
(evil-track-last-insertion BEG END OLD-LEN)
Documentation
Track the last insertion range and its text.
BEG, END and OLD-LEN are as for after-change-functions.
The insertion range is stored as a pair of buffer positions in
evil-current-insertion.
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
;;; Insertion
(defun evil-track-last-insertion (beg end old-len)
"Track the last insertion range and its text.
BEG, END and OLD-LEN are as for `after-change-functions'.
The insertion range is stored as a pair of buffer positions in
`evil-current-insertion'."
;; For deletions left of, or insertions right of the end of the last
;; insertion (with any changes in between), extend or contract the
;; insertion range as appropriate. Otherwise, start a new range.
(if (when evil-current-insertion
(let ((ins-beg (car evil-current-insertion))
(ins-end (cdr evil-current-insertion)))
(and (<= ins-beg beg)
(or (= (+ beg old-len) ins-end)
(when (evil-replace-state-p) (= beg ins-end))))))
;; Ignore insertion of previous char from Backspace in Replace state
(unless (and (eq this-command 'evil-replace-backspace) (= old-len 0))
(setcdr evil-current-insertion end))
(setq evil-current-insertion (cons beg end))))