Function: evil--ex-substitute-final-message

evil--ex-substitute-final-message is a byte-compiled function defined in evil-commands.el.

Signature

(evil--ex-substitute-final-message NREPLACED FLAGS)

Documentation

Display message according to replacements and flags.

If FLAGS contains "p" or "#" and NREPLACED is more than 0, print the last line to the echo area. Otherwise, print the number of replacements made or found.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(defun evil--ex-substitute-final-message (nreplaced flags)
  "Display message according to replacements and flags.
If FLAGS contains \"p\" or \"#\" and NREPLACED is more than 0, print
the last line to the echo area.  Otherwise, print the number of
replacements made or found."
  (let ((replaced-any (< 0 nreplaced)))
    (cond
     ((and replaced-any (memq ?p flags))
      (evil-echo "%s" (buffer-substring (line-beginning-position)
                                        (line-end-position))))
     ((and replaced-any (memq ?# flags))
      (evil-echo "%s %s" (propertize (number-to-string (line-number-at-pos))
                                     'face 'line-number-current-line)
                         (buffer-substring (line-beginning-position)
                                           (line-end-position))))
     (t (evil-echo "%s %d occurrence%s"
                   (if (memq ?n flags) "Found" "Replaced")
                   nreplaced
                   (if (/= nreplaced 1) "s" ""))))))