comparison lisp/isearch.el @ 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 4fb2d507742d
children a74474ba690a cce1c0ee76ee
comparison
equal deleted inserted replaced
57024:f7a178c7c443 57025:862d0c555534
2400 (setq looping nil))) 2400 (setq looping nil)))
2401 (if found 2401 (if found
2402 (let ((mb (match-beginning 0)) 2402 (let ((mb (match-beginning 0))
2403 (me (match-end 0))) 2403 (me (match-end 0)))
2404 (if (= mb me) ;zero-length match 2404 (if (= mb me) ;zero-length match
2405 (forward-char 1) 2405 (if isearch-forward
2406 (if (= mb (if isearch-lazy-highlight-wrapped
2407 isearch-lazy-highlight-start
2408 (window-end)))
2409 (setq found nil)
2410 (forward-char 1))
2411 (if (= mb (if isearch-lazy-highlight-wrapped
2412 isearch-lazy-highlight-end
2413 (window-start)))
2414 (setq found nil)
2415 (forward-char -1)))
2406 2416
2407 ;; non-zero-length match 2417 ;; non-zero-length match
2408 (let ((ov (make-overlay mb me))) 2418 (let ((ov (make-overlay mb me)))
2409 (overlay-put ov 'face isearch-lazy-highlight-face) 2419 (overlay-put ov 'face isearch-lazy-highlight-face)
2410 (overlay-put ov 'priority 0) ;lower than main overlay 2420 (overlay-put ov 'priority 0) ;lower than main overlay
2411 (overlay-put ov 'window (selected-window)) 2421 (overlay-put ov 'window (selected-window))
2412 (push ov isearch-lazy-highlight-overlays))) 2422 (push ov isearch-lazy-highlight-overlays)))
2413 (if isearch-forward 2423 (if isearch-forward
2414 (setq isearch-lazy-highlight-end (point)) 2424 (setq isearch-lazy-highlight-end (point))
2415 (setq isearch-lazy-highlight-start (point)))) 2425 (setq isearch-lazy-highlight-start (point)))))
2416 2426
2417 ;; not found 2427 ;; not found or zero-length match at the search bound
2418 (if isearch-lazy-highlight-wrapped 2428 (if (not found)
2419 (setq looping nil 2429 (if isearch-lazy-highlight-wrapped
2420 nomore t) 2430 (setq looping nil
2421 (setq isearch-lazy-highlight-wrapped t) 2431 nomore t)
2422 (if isearch-forward 2432 (setq isearch-lazy-highlight-wrapped t)
2423 (progn 2433 (if isearch-forward
2424 (setq isearch-lazy-highlight-end (window-start)) 2434 (progn
2425 (goto-char (window-start))) 2435 (setq isearch-lazy-highlight-end (window-start))
2426 (setq isearch-lazy-highlight-start (window-end)) 2436 (goto-char (window-start)))
2427 (goto-char (window-end))))))) 2437 (setq isearch-lazy-highlight-start (window-end))
2438 (goto-char (window-end)))))))
2428 (unless nomore 2439 (unless nomore
2429 (setq isearch-lazy-highlight-timer 2440 (setq isearch-lazy-highlight-timer
2430 (run-at-time isearch-lazy-highlight-interval nil 2441 (run-at-time isearch-lazy-highlight-interval nil
2431 'isearch-lazy-highlight-update))))))) 2442 'isearch-lazy-highlight-update)))))))
2432 2443