branch: master
commit 7ed2cafffdabb233c8056f1a9df418cdd0970328
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    swiper.el (swiper--add-overlays): Skip background for super-long matches
---
 swiper.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/swiper.el b/swiper.el
index 0702686..0bc7f96 100644
--- a/swiper.el
+++ b/swiper.el
@@ -651,11 +651,14 @@ WND, when specified is the window."
           ;; RE can become an invalid regexp
           (while (and (ignore-errors (re-search-forward re end t))
                       (> (- (match-end 0) (match-beginning 0)) 0))
-            (swiper--add-overlay (match-beginning 0) (match-end 0)
-                                 (if (zerop ivy--subexps)
-                                     (cadr swiper-faces)
-                                   (car swiper-faces))
-                                 wnd 0)
+            (let ((mb (match-beginning 0))
+                  (me (match-end 0)))
+              (unless (> (- me mb) 2017)
+                (swiper--add-overlay mb me
+                                     (if (zerop ivy--subexps)
+                                         (cadr swiper-faces)
+                                       (car swiper-faces))
+                                     wnd 0)))
             (let ((i 1)
                   (j 0))
               (while (<= (cl-incf j) ivy--subexps)

Reply via email to