(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))