]> git.eshelyaron.com Git - emacs.git/commitdiff
Respect point when changing direction after isearch scrolling.
authorJuri Linkov <juri@linkov.net>
Tue, 29 Apr 2025 16:35:30 +0000 (19:35 +0300)
committerEshel Yaron <me@eshelyaron.com>
Thu, 1 May 2025 07:23:15 +0000 (09:23 +0200)
* lisp/isearch.el (isearch-repeat): Don't go to isearch-other-end
on changing direction after scrolling (bug#78074).

(cherry picked from commit 622825995204b7aae70b836c8e5e5d44385c401b)

lisp/isearch.el

index aaa3df75a9e48c89dea0705d43fe71516399cb30..19d13057eff3cbc7ba5b4e918c6cf359ddfd064d 100644 (file)
@@ -1910,7 +1910,14 @@ Use `isearch-exit' to quit without signaling."
              (funcall isearch-wrap-function)
            (goto-char (if isearch-forward (point-min) (point-max))))))
     ;; C-s in reverse or C-r in forward, change direction.
-    (if (and isearch-other-end isearch-repeat-on-direction-change)
+    (if (and isearch-other-end isearch-repeat-on-direction-change
+             (or (null isearch-cmds)
+                 ;; Go to 'isearch-other-end' only when point is still
+                 ;; on the current match.  However, after scrolling
+                 ;; (when 'isearch-allow-scroll' is 'unlimited'),
+                 ;; repeat the reversed search from a new position
+                 ;; where point was moved during scrolling (bug#78074).
+                 (eq (isearch--state-point (car isearch-cmds)) (point))))
         (goto-char isearch-other-end))
     (setq isearch-forward (not isearch-forward)
          isearch-success t))