Function: evil-yank-line-handler

evil-yank-line-handler is a byte-compiled function defined in evil-common.el.

Signature

(evil-yank-line-handler TEXT)

Documentation

Insert the current text linewise.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-yank-line-handler (text)
  "Insert the current text linewise."
  (let ((text (apply #'concat (make-list (or evil-paste-count 1) text)))
        (opoint (point)))
    (evil-remove-yank-excluded-properties text)
    (cond
     ((eq this-command 'evil-paste-before)
      (evil-move-beginning-of-line)
      (let ((beg (point)))
        (insert text)
        (setq evil-last-paste
              (list 'evil-paste-before evil-paste-count opoint beg (point)))
        (evil-set-marker ?\[ beg)
        (evil-set-marker ?\] (1- (point)))
        (goto-char beg))
      (back-to-indentation))
     ((eq this-command 'evil-paste-after)
      (evil-move-end-of-line)
      (let ((beg (point)))
        (insert "\n")
        (insert text)
        (delete-char -1) ; delete the last newline
        (setq evil-last-paste
              (list 'evil-paste-after evil-paste-count opoint beg (point)))
        (evil-set-marker ?\[ (1+ beg))
        (evil-set-marker ?\] (point))
        (unless evil--cursor-after
          (goto-char (1+ beg))))
      (back-to-indentation))
     (t (insert text)))))