Function: evil-screen-line-string

evil-screen-line-string is a byte-compiled function defined in evil-types.el.

Signature

(evil-screen-line-string BEG END &rest PROPERTIES)

Documentation

Return size of screen-line from BEG to END with PROPERTIES.

Include whole lines, being aware of visual-line-mode(var)/visual-line-mode(fun) when evil-respect-visual-line-mode is non-nil.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20260728.1438/evil-types.el
(evil-define-type screen-line
  "Include whole lines, being aware of `visual-line-mode'
when `evil-respect-visual-line-mode' is non-nil."
  :one-to-one nil
  :expand (lambda (beg end)
            (if (not (and evil-respect-visual-line-mode visual-line-mode))
                (evil-line-expand beg end)
              (evil-range
               (progn
                 (goto-char beg)
                 (save-excursion
                   (beginning-of-visual-line)))
               (progn
                 (goto-char end)
                 (save-excursion
                   ;; `beginning-of-visual-line' reverts to the beginning of the
                   ;; last visual line if the end of the last line is the end of
                   ;; the buffer. This would prevent selecting the last screen
                   ;; line.
                   (if (= (line-beginning-position 2) (point-max))
                       (point-max)
                     (beginning-of-visual-line 2)))))))
  :contract (lambda (beg end)
              (evil-range beg (max beg (1- end))))
  :string (lambda (beg end)
            (let ((height (count-screen-lines beg end)))
              (format "%s screen line%s" height
                      (if (= height 1) "" "s")))))