From b54ec5aac9e25b534686c13aa2d09a61200c6fd9 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 15 Jun 2026 23:07:37 -0500 Subject: fix(dirvish): mark-all-visible no longer skips every other file dired-mark advances point itself, so the loop's extra forward-line skipped every other file (and could mark a directory). Use dired-get-filename + file-directory-p with an if/else: a marked file line advances once via dired-mark, non-file/directory lines advance manually. Replaces the regex line predicate (retired with its mock test) with a real-Dired marked-count test. --- tests/test-dirvish-config-public-wrappers.el | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'tests/test-dirvish-config-public-wrappers.el') diff --git a/tests/test-dirvish-config-public-wrappers.el b/tests/test-dirvish-config-public-wrappers.el index 0a999864..cec979e4 100644 --- a/tests/test-dirvish-config-public-wrappers.el +++ b/tests/test-dirvish-config-public-wrappers.el @@ -101,22 +101,9 @@ confused when several built-ins are overridden in the same test." (when (file-exists-p dst) (delete-file dst))))) ;;; cj/dired-mark-all-visible-files - -(ert-deftest test-dirvish-mark-all-visible-skips-directories () - "Normal: directory lines are skipped, file lines are marked." - (let ((marks 0)) - (with-temp-buffer - ;; Real dired listing has lines like " drwxr... dir/" or " -rw... file". - ;; The helper `cj/--dired-line-is-directory-p' matches "d". - (insert " drwxr-xr-x subdir\n" - " -rw-r--r-- file1.txt\n" - " -rw-r--r-- file2.txt\n") - (goto-char (point-min)) - (cl-letf (((symbol-function 'dired-mark) - (lambda (&rest _) (cl-incf marks)))) - (cj/dired-mark-all-visible-files))) - ;; 2 file lines marked; the directory line + the trailing empty line skipped. - (should (= marks 2)))) +;; Covered by test-dirvish-config-mark-all-visible.el, which exercises the loop +;; against a real Dired buffer (the previous fake-buffer mock coupled to the +;; retired regex helper). ;;; cj/dired-copy-path-as-kill -- cgit v1.2.3