Function: magit-file-region-line-numbers

magit-file-region-line-numbers is a byte-compiled function defined in magit-mode.el.

Signature

(magit-file-region-line-numbers)

Documentation

Return the bounds of the region as line numbers.

The returned value has the form (BEGINNING-LINE END-LINE). If the region ends at the beginning of a line, do not include that line. Avoid including the line after the end of the file.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-mode.el
(defun magit-file-region-line-numbers ()
  "Return the bounds of the region as line numbers.
The returned value has the form (BEGINNING-LINE END-LINE).  If
the region ends at the beginning of a line, do not include that
line.  Avoid including the line after the end of the file."
  (and (magit-buffer-file-name)
       (region-active-p)
       (not (= (region-beginning) (region-end) (1+ (buffer-size))))
       (let ((beg (region-beginning))
             (end (min (region-end) (buffer-size))))
         (list (line-number-at-pos beg t)
               (line-number-at-pos (if (= (magit--bol-position end) end)
                                       (max beg (1- end))
                                     end)
                                   t)))))