[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33838: 27.0.50; lazy-highlight fails with a quick key sequence
From: |
Juri Linkov |
Subject: |
bug#33838: 27.0.50; lazy-highlight fails with a quick key sequence |
Date: |
Mon, 24 Dec 2018 01:27:22 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) |
> Quickly typing `C-s C-s' to repeat the last search in a file with long
> wrapped lines sometimes fails to lazy-highlight other matches.
>
> This is because the condition in isearch-lazy-highlight-new-loop relies on
> the return value of `(sit-for 0)' and when there is input pending like the
> second `C-s' keystroke unprocessed due to the large file size with long
> lines, it doesn't start a new lazy-highlight loop.
I realized that sit-for here is for a reason to not try running
isearch-lazy-highlight-new-loop on every keypress. The problem is that
when the first `C-s' is ignored (in this case isearch-string is an empty
string and isearch-lazy-highlight-last-string is the last search string),
for the second `C-s', isearch-string is equal to
isearch-lazy-highlight-last-string
from the last search, so a new loop is not initiated.
A proper fix would be to reset isearch-lazy-highlight-last-string
on exiting Isearch, so it won't affect the next search:
diff --git a/lisp/isearch.el b/lisp/isearch.el
index dd0973d4ea..d2c1c150b5 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1357,6 +1357,7 @@ isearch-done
(setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)
(isearch-dehighlight)
(lazy-highlight-cleanup lazy-highlight-cleanup)
+ (setq isearch-lazy-highlight-last-string nil)
(let ((found-start (window-group-start))
(found-point (point)))
(when isearch-window-configuration