summaryrefslogtreecommitdiff
path: root/lisp/isearch.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-02-18 00:41:50 +0000
committerMiles Bader <miles@gnu.org>2005-02-18 00:41:50 +0000
commit8d46efcc0f2045a1e5a2739c55ba6a88fbf4bcfc (patch)
treebc968a02587d51199537bb335d5494e756e35fdf /lisp/isearch.el
parent8589dc17f80450f5773a2d449fa6d94c9bb04fe3 (diff)
parent9b516537a9899900647d4eae5ec8778e6837ad3c (diff)
downloademacs-8d46efcc0f2045a1e5a2739c55ba6a88fbf4bcfc.tar.gz
emacs-8d46efcc0f2045a1e5a2739c55ba6a88fbf4bcfc.tar.bz2
emacs-8d46efcc0f2045a1e5a2739c55ba6a88fbf4bcfc.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-95 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-96 Move Gnus images into etc/images * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-97 - miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-105 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-14 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-15 Update from CVS: lisp/imap.el (imap-log): Doc fix. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-16 Merge from emacs--cvs-trunk--0
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el35
1 files changed, 23 insertions, 12 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 7702707c6ac..f1cb55e7fcc 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -736,7 +736,8 @@ is treated as a regexp. See \\[isearch-forward] for more info."
(setq ;; quit-flag nil not for isearch-mode
isearch-adjusted nil
isearch-yank-flag nil)
- (if isearch-lazy-highlight (isearch-lazy-highlight-new-loop))
+ (when isearch-lazy-highlight
+ (isearch-lazy-highlight-new-loop nil nil))
;; We must prevent the point moving to the end of composition when a
;; part of the composition has just been searched.
(setq disable-point-adjustment t))
@@ -2310,6 +2311,8 @@ since they have special meaning in a regexp."
(defvar isearch-lazy-highlight-overlays nil)
(defvar isearch-lazy-highlight-wrapped nil)
+(defvar isearch-lazy-highlight-start-limit nil)
+(defvar isearch-lazy-highlight-end-limit nil)
(defvar isearch-lazy-highlight-start nil)
(defvar isearch-lazy-highlight-end nil)
(defvar isearch-lazy-highlight-timer nil)
@@ -2335,10 +2338,12 @@ is nil. This function is called when exiting an incremental search if
(cancel-timer isearch-lazy-highlight-timer)
(setq isearch-lazy-highlight-timer nil)))
-(defun isearch-lazy-highlight-new-loop ()
+(defun isearch-lazy-highlight-new-loop (beg end)
"Cleanup any previous `lazy-highlight' loop and begin a new one.
-This happens when `isearch-update' is invoked (which can cause the
-search string to change or the window to scroll)."
+BEG and END specify the bounds within which highlighting should occur.
+This is called when `isearch-update' is invoked (which can cause the
+search string to change or the window to scroll). It is also used
+by other Emacs features."
(when (and (null executing-kbd-macro)
(sit-for 0) ;make sure (window-start) is credible
(or (not (equal isearch-string
@@ -2356,6 +2361,8 @@ search string to change or the window to scroll)."
;; something important did indeed change
(isearch-lazy-highlight-cleanup t) ;kill old loop & remove overlays
(when (not isearch-invalid-regexp)
+ (setq isearch-lazy-highlight-start-limit beg
+ isearch-lazy-highlight-end-limit end)
(setq isearch-lazy-highlight-window (selected-window)
isearch-lazy-highlight-window-start (window-start)
isearch-lazy-highlight-window-end (window-end)
@@ -2378,12 +2385,14 @@ Attempt to do the search exactly the way the pending isearch would."
(funcall (isearch-search-fun)
isearch-string
(if isearch-forward
- (if isearch-lazy-highlight-wrapped
- isearch-lazy-highlight-start
- (window-end))
- (if isearch-lazy-highlight-wrapped
- isearch-lazy-highlight-end
- (window-start)))
+ (min (or isearch-lazy-highlight-end-limit (point-max))
+ (if isearch-lazy-highlight-wrapped
+ isearch-lazy-highlight-start
+ (window-end)))
+ (max (or isearch-lazy-highlight-start-limit (point-min))
+ (if isearch-lazy-highlight-wrapped
+ isearch-lazy-highlight-end
+ (window-start))))
t)))
(defun isearch-lazy-highlight-update ()
@@ -2442,9 +2451,11 @@ Attempt to do the search exactly the way the pending isearch would."
(if isearch-forward
(progn
(setq isearch-lazy-highlight-end (window-start))
- (goto-char (window-start)))
+ (goto-char (max (or isearch-lazy-highlight-start-limit (point-min))
+ (window-start))))
(setq isearch-lazy-highlight-start (window-end))
- (goto-char (window-end)))))))
+ (goto-char (min (or isearch-lazy-highlight-end-limit (point-max))
+ (window-end))))))))
(unless nomore
(setq isearch-lazy-highlight-timer
(run-at-time lazy-highlight-interval nil