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

From: Juri Linkov <[email-masked]>
Date: Mon, 08 Aug 2022 20:20:41 +0300

While waiting when buffer-local current_buffer->long_line_optimizations_p
will be exposed to Lisp, I noticed another need for lazy-highlight optimization:
in large buffers (but without long lines) some customization makes replacement
too slow when lazy-highlight tries to rehighlight the whole buffer
after every replacement.  For query-replace it should be enough to
highlight matches only on the displayed screen, therefore this patch
fixes the problem:

```
diff --git a/lisp/replace.el b/lisp/replace.el
index cac0edf43a..9a1f6f22e0 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2744,7 +2750,9 @@ replace-highlight
 	    (isearch-case-fold-search case-fold)
 	    (isearch-forward (not backward))
 	    (isearch-other-end match-beg)
-	    (isearch-error nil))
+	    (isearch-error nil)
+	    (isearch-lazy-count nil)
+	    (lazy-highlight-buffer nil))
 	(isearch-lazy-highlight-new-loop range-beg range-end))))
```