]> git.eshelyaron.com Git - emacs.git/commitdiff
(isearch-lazy-highlight-update):
authorRichard M. Stallman <rms@gnu.org>
Thu, 11 Jan 2001 08:08:51 +0000 (08:08 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 11 Jan 2001 08:08:51 +0000 (08:08 +0000)
Don't look for more potential matches once maximum is exceeded.
Use overlays-in to check correctly for overlap with current match.
Ignore empty matches.

lisp/isearch.el

index 16c46430c67bf278457bd5e373bf8b8e1cfb3c52..997cdc6aac9764fcb40050f608a8b5f8196a6158 100644 (file)
@@ -1987,28 +1987,32 @@ search string to change)."
     (isearch-lazy-highlight-remove-overlays (window-start)
                                            (window-end nil t))
 
-    (when (or (null isearch-lazy-highlight-max)
-             (< (length isearch-lazy-highlight-overlays)
-                isearch-lazy-highlight-max))
-      (save-excursion
-       (save-match-data
-         (let (found)
-           (goto-char isearch-lazy-highlight-start)
-           (while (let ((case-fold-search isearch-case-fold-search))
-                    (funcall (cond (isearch-word 'word-search-forward)
-                                   (isearch-regexp 're-search-forward)
-                                   (t 'search-forward))
-                             isearch-string
-                             isearch-lazy-highlight-end
-                             t))
-             ;; Found the next match.
+    (save-excursion
+      (save-match-data
+       (let (found)
+         (goto-char isearch-lazy-highlight-start)
+         (while (and (or (null isearch-lazy-highlight-max)
+                         (< (length isearch-lazy-highlight-overlays)
+                            isearch-lazy-highlight-max))
+                     (< (point) isearch-lazy-highlight-end)
+                     (let ((case-fold-search isearch-case-fold-search))
+                       (funcall (cond (isearch-word 'word-search-forward)
+                                      (isearch-regexp 're-search-forward)
+                                      (t 'search-forward))
+                                isearch-string
+                                isearch-lazy-highlight-end
+                                t)))
+           ;; Found the next match.
+           ;; If it is empty, ignore it and move on.
+           (if (= (match-beginning 0) (match-end 0))
+               (forward-char 1)
              (let ((ov (make-overlay (match-beginning 0)
                                      (match-end 0))))
                ;; If OV overlaps the current isearch overlay, suppress
                ;; its face property; otherwise, we sometimes get odd
                ;; looking face combinations.
                (unless (memq isearch-overlay
-                             (overlays-at (match-beginning 0)))
+                             (overlays-in (match-beginning 0) (match-end 0)))
                  (overlay-put ov 'face isearch-lazy-highlight-face))
 
                (overlay-put ov 'priority 0)