Function: magit-next-line

magit-next-line is an autoloaded, interactive and byte-compiled function defined in magit-extras.el.

Signature

(magit-next-line &optional ARG TRY-VSCROLL)

Documentation

Like next-line but with Magit-specific shift-selection.

Magit's selection mechanism is based on the region but selects an area that is larger than the region. This causes next-line when invoked while holding the shift key to move down one line and thereby select two lines. When invoked inside a hunk body this command does not move point on the first invocation and thereby it only selects a single line. Which inconsistency you prefer is a matter of preference.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-extras.el
;;;###autoload
(defun magit-next-line (&optional arg try-vscroll)
  "Like `next-line' but with Magit-specific shift-selection.

Magit's selection mechanism is based on the region but selects
an area that is larger than the region.  This causes `next-line'
when invoked while holding the shift key to move down one line
and thereby select two lines.  When invoked inside a hunk body
this command does not move point on the first invocation and
thereby it only selects a single line.  Which inconsistency you
prefer is a matter of preference."
  (declare (interactive-only forward-line))
  (interactive "p\np")
  (unless arg (setq arg 1))
  (let ((stay (or (magit-diff-inside-hunk-body-p)
                  (magit-section-position-in-heading-p))))
    (if (and stay (= arg 1) (magit--turn-on-shift-select-mode-p))
        (push-mark nil nil t)
      (with-no-warnings
        (handle-shift-selection)
        (next-line (if stay (max (1- arg) 1) arg) try-vscroll)))))