changeset 57025:862d0c555534

(isearch-lazy-highlight-update): Take into account the case of zero-length match at the search bound.
author Juri Linkov <juri@jurta.org>
date Wed, 08 Sep 2004 20:43:17 +0000
parents f7a178c7c443
children 992d9837a265
files lisp/isearch.el
diffstat 1 files changed, 24 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/isearch.el	Wed Sep 08 20:31:41 2004 +0000
+++ b/lisp/isearch.el	Wed Sep 08 20:43:17 2004 +0000
@@ -2402,7 +2402,17 @@
                 (let ((mb (match-beginning 0))
                       (me (match-end 0)))
                   (if (= mb me)      ;zero-length match
-                      (forward-char 1)
+		      (if isearch-forward
+			  (if (= mb (if isearch-lazy-highlight-wrapped
+					isearch-lazy-highlight-start
+				      (window-end)))
+			      (setq found nil)
+			    (forward-char 1))
+			(if (= mb (if isearch-lazy-highlight-wrapped
+				      isearch-lazy-highlight-end
+				    (window-start)))
+			    (setq found nil)
+			  (forward-char -1)))
 
                     ;; non-zero-length match
                     (let ((ov (make-overlay mb me)))
@@ -2412,19 +2422,20 @@
                       (push ov isearch-lazy-highlight-overlays)))
                   (if isearch-forward
                       (setq isearch-lazy-highlight-end (point))
-                    (setq isearch-lazy-highlight-start (point))))
+                    (setq isearch-lazy-highlight-start (point)))))
 
-              ;; not found
-              (if isearch-lazy-highlight-wrapped
-                  (setq looping nil
-                        nomore  t)
-                (setq isearch-lazy-highlight-wrapped t)
-                (if isearch-forward
-                    (progn
-                      (setq isearch-lazy-highlight-end (window-start))
-                      (goto-char (window-start)))
-                  (setq isearch-lazy-highlight-start (window-end))
-                  (goto-char (window-end)))))))
+	    ;; not found or zero-length match at the search bound
+	    (if (not found)
+		(if isearch-lazy-highlight-wrapped
+		    (setq looping nil
+			  nomore  t)
+		  (setq isearch-lazy-highlight-wrapped t)
+		  (if isearch-forward
+		      (progn
+			(setq isearch-lazy-highlight-end (window-start))
+			(goto-char (window-start)))
+		    (setq isearch-lazy-highlight-start (window-end))
+		    (goto-char (window-end)))))))
         (unless nomore
           (setq isearch-lazy-highlight-timer
                 (run-at-time isearch-lazy-highlight-interval nil