Fix 'dired-movement-style' in Dired when subdirs are shown

* lisp/dired.el (dired--move-to-next-line): Don't consider
sub-directory lines as empty.  (Bug#76596)
This commit is contained in:
Eli Zaretskii 2025-03-13 12:34:23 +02:00
parent f8443dffc1
commit 04034cd9ce

View file

@ -2888,15 +2888,19 @@ is controlled by `dired-movement-style'."
(setq wrapped t)) (setq wrapped t))
;; `bounded': go back to the last non-empty line. ;; `bounded': go back to the last non-empty line.
(dired-movement-style ; Either 'bounded or anything else non-nil. (dired-movement-style ; Either 'bounded or anything else non-nil.
(while (and (dired-between-files) (not (zerop arg))) (while (and (dired-between-files)
(not (dired-get-subdir))
(not (zerop arg)))
(funcall jumpfun (- moving-down)) (funcall jumpfun (- moving-down))
;; Point not moving means infinite loop. ;; Point not moving means infinite loop.
(if (= old-position (point)) (if (= old-position (point))
(setq arg 0) (setq arg 0)
(setq old-position (point)))) (setq old-position (point))))
;; Encountered a boundary, so let's stop movement. ;; Encountered a boundary, so let's stop movement.
(setq arg (if (dired-between-files) 0 moving-down))))) (setq arg (if (and (dired-between-files)
(unless (dired-between-files) (not (dired-get-subdir)))
0 moving-down)))))
(unless (and (dired-between-files) (not (dired-get-subdir)))
;; Has moved to a non-empty line. This movement does ;; Has moved to a non-empty line. This movement does
;; make sense. ;; make sense.
(cl-decf arg moving-down)) (cl-decf arg moving-down))