branch: externals/ivy-hydra
commit 96668201c1ed5ab76b8a6531799ade6ce4ae5ede
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    swiper.el (swiper--add-overlays): Don't miss highlights when at eol
    
    When the last match was at eol, and the regex is e.g. "[^ ]", it will
    match the newline and so the total will span 2 lines, excluding it
    from the highlight. We don't want this to happen.
---
 swiper.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/swiper.el b/swiper.el
index eeb941d..25f818f 100644
--- a/swiper.el
+++ b/swiper.el
@@ -1001,8 +1001,12 @@ WND, when specified is the window."
       (save-excursion
         (goto-char beg)
         ;; RE can become an invalid regexp
-        (while (and (ignore-errors (re-search-forward re end t))
-                    (> (- (match-end 0) (match-beginning 0)) 0))
+        (while (progn
+                 (when (eolp)
+                   (unless (eobp)
+                     (forward-char)))
+                 (and (ignore-errors (re-search-forward re end t))
+                      (> (- (match-end 0) (match-beginning 0)) 0)))
           ;; Don't highlight a match if it spans multiple
           ;; lines. `count-lines' returns 1 if the match is within a
           ;; single line, even if it includes the newline, and 2 or

Reply via email to