diff options
| author | Richard M. Stallman | 2001-01-11 08:08:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-01-11 08:08:51 +0000 |
| commit | 7742ee19243d8b631b144199b84170e22ac9ac60 (patch) | |
| tree | 1564b7e171ab05757d2f8a33d4a6073d56fa4907 | |
| parent | afa1f52c139a71d1fa254a61dd39cb2d8230c9d3 (diff) | |
| download | emacs-7742ee19243d8b631b144199b84170e22ac9ac60.tar.gz emacs-7742ee19243d8b631b144199b84170e22ac9ac60.zip | |
(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.
| -rw-r--r-- | lisp/isearch.el | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 16c46430c67..997cdc6aac9 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -1987,28 +1987,32 @@ search string to change)." | |||
| 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) |