mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-13 21:33:05 +00:00
Customize how `avy-lead-face-0' is applied
* avy.el (avy-highlight-first): New defcustom. When non-nil, use `avy-lead-face-0' even on terminal chars. (avy--overlay-pre): Update. (avy--overlay-at-full): Update. (avy--overlay-post): Update. Fixes #42
This commit is contained in:
parent
1127467669
commit
ea6f5c5953
11
avy.el
11
avy.el
@ -374,13 +374,18 @@ When GROUP is non-nil, (BEG . END) should delimit that regex group."
|
||||
(overlay-put ol 'display (concat str old-str))
|
||||
(push ol avy--overlays-lead))))
|
||||
|
||||
(defcustom avy-highlight-first nil
|
||||
"When non-nil highlight the first decision char with `avy-lead-face-0'.
|
||||
Do this even when the char is terminating."
|
||||
:type 'boolean)
|
||||
|
||||
(defun avy--overlay-pre (path leaf)
|
||||
"Create an overlay with PATH at LEAF.
|
||||
PATH is a list of keys from tree root to LEAF.
|
||||
LEAF is normally ((BEG . END) . WND)."
|
||||
(let ((str (propertize (apply #'string (reverse path))
|
||||
'face 'avy-lead-face)))
|
||||
(when (> (length str) 1)
|
||||
(when (or avy-highlight-first (> (length str) 1))
|
||||
(set-text-properties 0 1 '(face avy-lead-face-0) str))
|
||||
(setq str (concat
|
||||
(propertize avy-current-path
|
||||
@ -435,7 +440,7 @@ LEAF is normally ((BEG . END) . WND)."
|
||||
(caar leaf)
|
||||
(car leaf)))
|
||||
(wnd (cdr leaf)))
|
||||
(when (> (length str) 1)
|
||||
(when (or avy-highlight-first (> (length str) 1))
|
||||
(set-text-properties 0 1 '(face avy-lead-face-0) str))
|
||||
(with-selected-window wnd
|
||||
(save-excursion
|
||||
@ -469,7 +474,7 @@ PATH is a list of keys from tree root to LEAF.
|
||||
LEAF is normally ((BEG . END) . WND)."
|
||||
(let ((str (propertize (apply #'string (reverse path))
|
||||
'face 'avy-lead-face)))
|
||||
(when (> (length str) 1)
|
||||
(when (or avy-highlight-first (> (length str) 1))
|
||||
(set-text-properties 0 1 '(face avy-lead-face-0) str))
|
||||
(setq str (concat
|
||||
(propertize avy-current-path
|
||||
|
Loading…
x
Reference in New Issue
Block a user