Properly highlight depending on avy-all-windows

Before this change, the highlighting was only performed in the selected
window even if avy-all-windows was true.  Now it's consistent with the
value of that variable.
This commit is contained in:
Tassilo Horn 2015-10-06 21:31:12 +02:00
parent d439b9d44f
commit bda04b287b

22
avy.el
View File

@ -1075,15 +1075,19 @@ read string immediately instead of waiting for another char for
(setq str (concat str (list char))))) (setq str (concat str (list char)))))
;; Highlight ;; Highlight
(when (>= (length str) 1) (when (>= (length str) 1)
(save-excursion (dolist (win (if avy-all-windows
(goto-char (window-start)) (window-list)
(setq regex (regexp-quote str)) (list (selected-window))))
(while (re-search-forward regex (window-end) t) (with-selected-window win
(unless (get-char-property (point) 'invisible) (save-excursion
(let ((ov (make-overlay (match-beginning 0) (match-end 0)))) (goto-char (window-start))
(push ov overlays) (setq regex (regexp-quote str))
(overlay-put ov 'window (selected-window)) (while (re-search-forward regex (window-end) t)
(overlay-put ov 'face 'avy-goto-char-timer-face))))))) (unless (get-char-property (point) 'invisible)
(let ((ov (make-overlay (match-beginning 0) (match-end 0))))
(push ov overlays)
(overlay-put ov 'window (selected-window))
(overlay-put ov 'face 'avy-goto-char-timer-face)))))))))
str) str)
(dolist (ov overlays) (dolist (ov overlays)
(delete-overlay ov))))) (delete-overlay ov)))))