Reading the documentation for `buffer-invisibility-spec' more thouroughly, it now seems to me that a better patch would be:
diff -u isearch.el~ isearch.el
--- isearch.el~ 2019-09-10 02:32:49.000000000 +0200
+++ isearch.el 2022-06-03 09:40:59.991883469 +0200
@@ -2972,7 +2972,8 @@
  ;; skip all characters with that same `invisible' property value.
  ;; Do that over and over.
  (while (and (< (point) end) (invisible-p (point)))
-  (if (invisible-p (get-text-property (point) 'invisible))
+  (if (or (memq (get-text-property (point) 'invisible) buffer-invisibility-spec)
+  (assq (get-text-property (point) 'invisible) buffer-invisibility-spec))
       (progn
  (goto-char (next-single-property-change (point) 'invisible
  nil end))


Le ven. 3 juin 2022 à 09:23, Thierry EMERY <thierryalemery@gmail.com> a écrit :
(invisible-p (point)) has already been tested in the previous line, but it only tests that there is a text property, not actual invisibility:
(defun invisible-p (pos)
  (get-text-property pos 'invisible))

If the text property `invisible' has another symbol than t as value and `buffer-invisibility-spec' is a list (which is the case in dired, see below), then the text will only be invisible if that symbol is currently part of `buffer-invisibility-spec' (and that is used by `dired-hide-details-mode').

buffer-invisibility-spec is a variable defined in ‘C source code’.
Its value is (t)
Local in buffer lisp; global value is t

  Automatically becomes buffer-local when set.

Documentation:
Invisibility spec of this buffer.
The default is t, which means that text is invisible if it has a non-nil
‘invisible’ property.
This variable can also be a list.  The list can have two kinds of elements:
‘ATOM’ and ‘(ATOM . ELLIPSIS)’.  A text character is invisible if its
‘invisible’ property is ‘ATOM’, or has an ‘invisible’ property that is a list
that contains ‘ATOM’.
If the ‘(ATOM . ELLIPSIS)’ form is used, and ‘ELLIPSIS’ is non-nil, an
ellipsis will be displayed after the invisible characters.
Setting this variable is very fast, much faster than scanning all the text in
the buffer looking for properties to change.