avy.el (avy--overlay-pre): Fix conflict with visual-line-mode

This commit is contained in:
Oleh Krehel 2020-05-19 08:58:53 +02:00
parent 509471bad0
commit acf553cae2

29
avy.el
View File

@ -1068,19 +1068,22 @@ Do this even when the char is terminating."
"Create an overlay with PATH at LEAF. "Create an overlay with PATH at LEAF.
PATH is a list of keys from tree root to LEAF. PATH is a list of keys from tree root to LEAF.
LEAF is normally ((BEG . END) . WND)." LEAF is normally ((BEG . END) . WND)."
(let* ((path (mapcar #'avy--key-to-char path)) (if (with-selected-window (cdr leaf)
(str (propertize (apply #'string (reverse path)) (bound-and-true-p visual-line-mode))
'face 'avy-lead-face))) (avy--overlay-at-full path leaf)
(when (or avy-highlight-first (> (length str) 1)) (let* ((path (mapcar #'avy--key-to-char path))
(set-text-properties 0 1 '(face avy-lead-face-0) str)) (str (propertize (apply #'string (reverse path))
(setq str (concat 'face 'avy-lead-face)))
(propertize avy-current-path (when (or avy-highlight-first (> (length str) 1))
'face 'avy-lead-face-1) (set-text-properties 0 1 '(face avy-lead-face-0) str))
str)) (setq str (concat
(avy--overlay (propertize avy-current-path
str 'face 'avy-lead-face-1)
(avy-candidate-beg leaf) nil str))
(avy-candidate-wnd leaf)))) (avy--overlay
str
(avy-candidate-beg leaf) nil
(avy-candidate-wnd leaf)))))
(defun avy--overlay-at (path leaf) (defun avy--overlay-at (path leaf)
"Create an overlay with PATH at LEAF. "Create an overlay with PATH at LEAF.