* lisp/isearch.el (isearch-delete-char): Improve fix for bug#52248.

When reaching the top of the stack where isearch-other-end is nil,
still close unnecessary overlays for the previous position.
(isearch-close-unnecessary-overlays): Rename arg BEG for consistency.
This commit is contained in:
Juri Linkov 2022-06-28 20:20:21 +03:00
parent 7580f3f487
commit b10a6fd5bb

View file

@ -2522,11 +2522,12 @@ If no input items have been entered yet, just beep."
(if (null (cdr isearch-cmds))
(ding)
(isearch-pop-state))
;; When going back to the hidden match, reopen it.
(when (and (eq search-invisible 'open) isearch-hide-immediately
isearch-other-end)
(isearch-range-invisible (min (point) isearch-other-end)
(max (point) isearch-other-end)))
;; When going back to the hidden match, reopen it and close other overlays.
(when (and (eq search-invisible 'open) isearch-hide-immediately)
(if isearch-other-end
(isearch-range-invisible (min (point) isearch-other-end)
(max (point) isearch-other-end))
(isearch-close-unnecessary-overlays (point) (point))))
(isearch-update))
(defun isearch-del-char (&optional arg)
@ -3756,11 +3757,11 @@ Optional third argument, if t, means if fail just return nil (no error).
;; Verify if the current match is outside of each element of
;; `isearch-opened-overlays', if so close that overlay.
(defun isearch-close-unnecessary-overlays (begin end)
(defun isearch-close-unnecessary-overlays (beg end)
(let ((overlays isearch-opened-overlays))
(setq isearch-opened-overlays nil)
(dolist (ov overlays)
(if (isearch-intersects-p begin end (overlay-start ov) (overlay-end ov))
(if (isearch-intersects-p beg end (overlay-start ov) (overlay-end ov))
(push ov isearch-opened-overlays)
(let ((fct-temp (overlay-get ov 'isearch-open-invisible-temporary)))
(if fct-temp