mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-24 07:20:37 +00:00
(isearch-set-lazy-highlight-faces-at): New function.
(isearch-highlight): Restore lazy-isearch face properties at old position, and suppress them at new position. (isearch-dehighlight): Restore lazy-isearch face properties. (isearch-lazy-highlight-update): Add lazy-isearch overlays even over the real isearch overlay, but in that case, don't give it a face property. Use `push'.
This commit is contained in:
parent
a4249304d8
commit
4fb2ad9831
@ -1,3 +1,13 @@
|
||||
2000-10-12 Miles Bader <miles@lsi.nec.co.jp>
|
||||
|
||||
* isearch.el (isearch-set-lazy-highlight-faces-at): New function.
|
||||
(isearch-highlight): Restore lazy-isearch face properties at old
|
||||
position, and suppress them at new position.
|
||||
(isearch-dehighlight): Restore lazy-isearch face properties.
|
||||
(isearch-lazy-highlight-update): Add lazy-isearch overlays even
|
||||
over the real isearch overlay, but in that case, don't give it a
|
||||
face property. Use `push'.
|
||||
|
||||
2000-10-12 Kenichi Handa <handa@etl.go.jp>
|
||||
|
||||
* man.el (Man-getpage-in-background): Fix previous change.
|
||||
|
@ -1730,16 +1730,47 @@ If there is no completion possible, say so and continue searching."
|
||||
|
||||
(defvar isearch-overlay nil)
|
||||
|
||||
(defsubst isearch-set-lazy-highlight-faces-at (pos face)
|
||||
"Set the face property of isearch lazy highlight overlays at POS to FACE.
|
||||
If POS is nil, nothing is done."
|
||||
(unless (null pos)
|
||||
(dolist (ov (overlays-at pos))
|
||||
(when (and (not (eq ov isearch-overlay))
|
||||
(memq ov isearch-lazy-highlight-overlays)
|
||||
(not (eq (overlay-get ov 'face) face)))
|
||||
(overlay-put ov 'face face)))))
|
||||
|
||||
(defun isearch-highlight (beg end)
|
||||
(if (or (null search-highlight) (null (display-color-p)))
|
||||
nil
|
||||
(or isearch-overlay (setq isearch-overlay (make-overlay beg end)))
|
||||
(move-overlay isearch-overlay beg end (current-buffer))
|
||||
(overlay-put isearch-overlay 'face isearch)))
|
||||
(unless (or (null search-highlight) (null (display-color-p)))
|
||||
(cond (isearch-overlay
|
||||
;; Overlay already exists, just move it.
|
||||
|
||||
;; Check to see if there are any lazy-isearch overlays at
|
||||
;; the same position with their face property suppressed
|
||||
;; (to avoid face clashes), and if so, give them their face
|
||||
;; back.
|
||||
(isearch-set-lazy-highlight-faces-at (overlay-start isearch-overlay)
|
||||
isearch-lazy-highlight-face)
|
||||
|
||||
(move-overlay isearch-overlay beg end (current-buffer)))
|
||||
|
||||
(t
|
||||
;; Overlay doesn't exist, create it.
|
||||
(setq isearch-overlay (make-overlay beg end))
|
||||
(overlay-put isearch-overlay 'face isearch)))
|
||||
|
||||
;; Suppress the faces of any lazy-isearch overlays at the new position
|
||||
(isearch-set-lazy-highlight-faces-at beg nil)))
|
||||
|
||||
(defun isearch-dehighlight (totally)
|
||||
(if isearch-overlay
|
||||
(delete-overlay isearch-overlay)))
|
||||
(when isearch-overlay
|
||||
;; Check to see if there are any lazy-isearch overlays at the same
|
||||
;; position with their face property suppressed (to avoid face
|
||||
;; clashes), and if so, give them their face back.
|
||||
(isearch-set-lazy-highlight-faces-at (overlay-start isearch-overlay)
|
||||
isearch-lazy-highlight-face)
|
||||
(delete-overlay isearch-overlay)))
|
||||
|
||||
|
||||
;;; General utilities
|
||||
|
||||
@ -1933,21 +1964,20 @@ Attempt to do the search exactly the way the pending isearch would."
|
||||
isearch-lazy-highlight-start))
|
||||
(let ((found (isearch-lazy-highlight-search))) ;do search
|
||||
(if found
|
||||
(progn
|
||||
;; Don't put a second overlay with a different face
|
||||
;; over/under the overlay isearch uses to highlight the
|
||||
;; current match. That can lead to odd looking face
|
||||
;; combinations.
|
||||
;; found the next match
|
||||
(let ((ov (make-overlay (match-beginning 0)
|
||||
(match-end 0))))
|
||||
;; If OV overlaps the current isearch overlay, suppress
|
||||
;; its face property; otherwise, we sometimes get odd
|
||||
;; looking face combinations.
|
||||
(unless (memq isearch-overlay
|
||||
(overlays-at (match-beginning 0)))
|
||||
;; found the next match
|
||||
(let ((ov (make-overlay (match-beginning 0)
|
||||
(match-end 0))))
|
||||
(overlay-put ov 'face isearch-lazy-highlight-face)
|
||||
(overlay-put ov 'priority 0)
|
||||
(setq isearch-lazy-highlight-overlays
|
||||
(cons ov isearch-lazy-highlight-overlays))))
|
||||
|
||||
(overlay-put ov 'face isearch-lazy-highlight-face))
|
||||
|
||||
(overlay-put ov 'priority 0)
|
||||
|
||||
(push ov isearch-lazy-highlight-overlays)
|
||||
|
||||
(setq isearch-lazy-highlight-timer
|
||||
(run-at-time isearch-lazy-highlight-interval nil
|
||||
'isearch-lazy-highlight-update))
|
||||
|
Loading…
Reference in New Issue
Block a user