]> code.delx.au - gnu-emacs/commitdiff
(isearch-lazy-highlight-update): Take into account
authorJuri Linkov <juri@jurta.org>
Wed, 8 Sep 2004 20:43:17 +0000 (20:43 +0000)
committerJuri Linkov <juri@jurta.org>
Wed, 8 Sep 2004 20:43:17 +0000 (20:43 +0000)
the case of zero-length match at the search bound.

lisp/isearch.el

index 572553d816afed8e672da666cc6176990e111f5d..2398d56ab5f32b71f93ac34c633e89c7ee6b3e1a 100644 (file)
@@ -2402,7 +2402,17 @@ Attempt to do the search exactly the way the pending isearch would."
                 (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 @@ Attempt to do the search exactly the way the pending isearch would."
                       (push ov isearch-lazy-highlight-overlays)))
                   (if isearch-forward
                       (setq isearch-lazy-highlight-end (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)))))))
+                    (setq isearch-lazy-highlight-start (point)))))
+
+           ;; 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