Subject: Re: bug#56815: 29.0.50; Isearch lazy-highlight highlights too much when truncate-lines is in effect

From: Eli Zaretskii <[email-masked]>
Date: Sun, 21 Aug 2022 20:06:12 +0300

> From: Juri Linkov <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Sun, 21 Aug 2022 19:32:14 +0300
> 
> > You can now use the new long-line-optimizations-p predicate for that.
> > Although from your description above, perhaps Isearch should behave
> > like that in a buffer with line-truncation regardless of the long
> > lines.
> 
> This means using the same condition like in 'line-move'?
> 
>                   (and
>                    (or truncate-lines
>                        (and (integerp truncate-partial-width-windows)
>                             (< (window-total-width)
>                                truncate-partial-width-windows))
>                        (and truncate-partial-width-windows
>                             (not (integerp truncate-partial-width-windows))
>                             (not (window-full-width-p))))
>                    ;; ...or if lines are truncated, this buffer
>                    ;; doesn't have very long lines.
>                    (long-line-optimizations-p))

Yes, this is the (unfortunately complicated) way of determining
whether the window has truncated lines.

> I suggest to leave 'long-line-optimizations-p' at the end because

It _is_ at the end, isn't it?

> in such cases when 'lazy-highlight-cleanup' is customized to nil
> the users might want to leave highlighting on truncated lines
> after exiting Isearch to see matches when scrolling horizontally
> (when lines are not long).

Ideally, when the window is hscrolled, the matches that come into view
should be lazily highlighted, and those which become invisible should
be de-highlighted.