comparison lisp/isearch.el @ 35225:eee3a978c12e

(isearch-lazy-highlight-update): 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.
author Richard M. Stallman <rms@gnu.org>
date Thu, 11 Jan 2001 08:08:51 +0000
parents 0b2d36d2a4ea
children c6a74e51d185
comparison
equal deleted inserted replaced
35224:87ccb00542e1 35225:eee3a978c12e
1985 ;; If the string is the same, the old overlays are still usable 1985 ;; If the string is the same, the old overlays are still usable
1986 ;; if they are still visible in the window. 1986 ;; if they are still visible in the window.
1987 (isearch-lazy-highlight-remove-overlays (window-start) 1987 (isearch-lazy-highlight-remove-overlays (window-start)
1988 (window-end nil t)) 1988 (window-end nil t))
1989 1989
1990 (when (or (null isearch-lazy-highlight-max) 1990 (save-excursion
1991 (< (length isearch-lazy-highlight-overlays) 1991 (save-match-data
1992 isearch-lazy-highlight-max)) 1992 (let (found)
1993 (save-excursion 1993 (goto-char isearch-lazy-highlight-start)
1994 (save-match-data 1994 (while (and (or (null isearch-lazy-highlight-max)
1995 (let (found) 1995 (< (length isearch-lazy-highlight-overlays)
1996 (goto-char isearch-lazy-highlight-start) 1996 isearch-lazy-highlight-max))
1997 (while (let ((case-fold-search isearch-case-fold-search)) 1997 (< (point) isearch-lazy-highlight-end)
1998 (funcall (cond (isearch-word 'word-search-forward) 1998 (let ((case-fold-search isearch-case-fold-search))
1999 (isearch-regexp 're-search-forward) 1999 (funcall (cond (isearch-word 'word-search-forward)
2000 (t 'search-forward)) 2000 (isearch-regexp 're-search-forward)
2001 isearch-string 2001 (t 'search-forward))
2002 isearch-lazy-highlight-end 2002 isearch-string
2003 t)) 2003 isearch-lazy-highlight-end
2004 ;; Found the next match. 2004 t)))
2005 ;; Found the next match.
2006 ;; If it is empty, ignore it and move on.
2007 (if (= (match-beginning 0) (match-end 0))
2008 (forward-char 1)
2005 (let ((ov (make-overlay (match-beginning 0) 2009 (let ((ov (make-overlay (match-beginning 0)
2006 (match-end 0)))) 2010 (match-end 0))))
2007 ;; If OV overlaps the current isearch overlay, suppress 2011 ;; If OV overlaps the current isearch overlay, suppress
2008 ;; its face property; otherwise, we sometimes get odd 2012 ;; its face property; otherwise, we sometimes get odd
2009 ;; looking face combinations. 2013 ;; looking face combinations.
2010 (unless (memq isearch-overlay 2014 (unless (memq isearch-overlay
2011 (overlays-at (match-beginning 0))) 2015 (overlays-in (match-beginning 0) (match-end 0)))
2012 (overlay-put ov 'face isearch-lazy-highlight-face)) 2016 (overlay-put ov 'face isearch-lazy-highlight-face))
2013 2017
2014 (overlay-put ov 'priority 0) 2018 (overlay-put ov 'priority 0)
2015 ;; Don't highlight on any other windows. 2019 ;; Don't highlight on any other windows.
2016 (overlay-put ov 'window isearch-lazy-highlight-window) 2020 (overlay-put ov 'window isearch-lazy-highlight-window)