emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/ivy-hydra 2fe64cd 036/395: swiper.el (swiper--isearch-h


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 2fe64cd 036/395: swiper.el (swiper--isearch-highlight): Don't hang on empty match data
Date: Thu, 25 Feb 2021 08:31:26 -0500 (EST)

branch: externals/ivy-hydra
commit 2fe64cdac1fe9ebaad7d3b035f51d212c4f731a3
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    swiper.el (swiper--isearch-highlight): Don't hang on empty match data
---
 swiper.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/swiper.el b/swiper.el
index eae89be..eeb941d 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1558,16 +1558,19 @@ When not running `swiper-isearch' already, start it."
 (defun swiper--isearch-highlight (str &optional current)
   (let ((start 0)
         (i 0))
-    (while (string-match ivy--old-re str start)
-      (setq start (match-end 0))
-      (swiper--add-properties
-       (if (eq current i)
-           swiper-faces
-         swiper-background-faces)
-       (lambda (beg end face _priority)
-         (ivy-add-face-text-property
-          beg end face str)))
-      (cl-incf i))
+    (catch 'done
+      (while (string-match ivy--old-re str start)
+        (if (= (match-beginning 0) (match-end 0))
+            (throw 'done t)
+          (setq start (match-end 0)))
+        (swiper--add-properties
+         (if (eq current i)
+             swiper-faces
+           swiper-background-faces)
+         (lambda (beg end face _priority)
+           (ivy-add-face-text-property
+            beg end face str)))
+        (cl-incf i)))
     str))
 
 (defun swiper--isearch-format (index length cands regex current buffer)



reply via email to

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