emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to avoid flicker in Isearch with lazy count


From: Juri Linkov
Subject: Re: Patch to avoid flicker in Isearch with lazy count
Date: Wed, 27 Jan 2021 19:48:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> Setting ‘lazy-highlight-initial-delay’ to 0 (which should be a
> reasonable default on a modern machine) causes some flickering in the
> search buffer, and a lot of flickering in the echo are when
> ‘isearch-lazy-count’ is on.
>
> The attached patch addresses these problems.

Thanks for the patch.

> It also makes the desired effect of setting ‘lazy-highlight-initial-delay’
> to 0 the default, even though that variable is unchanged.

Does this mean that for users who already customized
‘lazy-highlight-initial-delay’ to 0, now it's recommended to
revert such customization, and leave it at its default non-zero value?
So after typing just one letter an initial delay is recommended,
and after typing more letters no delay.  Then this should be mentioned
in etc/NEWS.

> Flicker in the search buffer happens because the highlighting of
> matches happens after typing just one letter, and there are
> potentially many of those.  It is fixed by adding a new variable,
> ‘lazy-highlight-delay-max-chars’.  Lazy highlighting kicks in
> immediately if the search string is longer than that number.  I set
> the default value to 2, but maybe 1 is even better.
>
> Flicker in the echo area happens even with the default value of
> ‘lazy-highlight-initial-delay’, if less pronouncedly, and is due to
> too frequent updates to the echo area message.  This is solved by
> keeping the lazy count in the echo area of out of date for the
> fraction of a second where the lazy stuff is waiting to kick in.

Please see more comments:

>  (defcustom lazy-highlight-initial-delay 0.25
> -  "Seconds to wait before beginning to lazily highlight all matches."
> +  "Seconds to wait before beginning to lazily highlight all matches.
> +This setting only has effect if the current search string is at most
> +`lazy-highlight-initial-delay' character long."

Typo?  Maybe lazy-highlight-delay-max-chars?

>  (defcustom lazy-highlight-interval 0 ; 0.0625
> -  "Seconds between lazily highlighting successive matches."
> +  "Seconds between lazily highlighting successive matches.
> +This setting only has effect if the current search string is at most
> +`lazy-highlight-initial-delay' character long."

The same typo?

> +(defun isearch-lazy-highlight-with-timer (delay function)
> +  "Arrange for FUNCTION to be called in idle time, possibly with DELAY.
> +There is no delay if the current search string is longer than
> +`lazy-highlight-delay-max-chars'."
> +  (setq isearch-lazy-highlight-timer
> +        (run-with-idle-timer
> +         (if (> (length isearch-string) lazy-highlight-delay-max-chars) 0 
> delay)
> +         nil function)))

Currently, run-with-idle-timer is used for lazy-highlight-initial-delay,
and run-at-time for lazy-highlight-interval.  But you replaced all
with run-with-idle-timer.  Any reason not to use run-at-time
for lazy-highlight-interval to reduce delays for quickly finishing
the already started lazily highlighting successive matches?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]