Function: evil-expand-line-for-line-based-operators
evil-expand-line-for-line-based-operators is a byte-compiled function
defined in evil-commands.el.
Signature
(evil-expand-line-for-line-based-operators BEG END TYPE)
Documentation
Expand to line when in visual mode possibly changing BEG, END and TYPE.
Avoids double expansion for line-based commands like "V" or "D".
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(defun evil-expand-line-for-line-based-operators (beg end type)
"Expand to line when in visual mode possibly changing BEG, END and TYPE.
Avoids double expansion for line-based commands like \"V\" or \"D\"."
(when (evil-visual-state-p)
(unless (memq type '(line block screen-line))
;; Subtract 1 from end to avoid expanding to the next line
;; when \n is part of the visually selected region.
;; If removed (evil-expand beg end 'line)
;; will expand to the end of the next line instead of the current
;; line which will cause line expanding commands like 'Y' to
;; misbehave when used in visual state.
(when (eq ?\n (char-before end))
(cl-decf end))
(let ((range (evil-expand beg end (if (and evil-respect-visual-line-mode
visual-line-mode)
'screen-line
'line))))
(setq beg (evil-range-beginning range)
end (evil-range-end range)
type (evil-type range))))
(evil-exit-visual-state))
(list beg end type))