mirror of
https://github.com/abo-abo/avy.git
synced 2025-10-14 05:43:04 +00:00
Modify at-full' and
de-bruijn' overlays to color depth
* avy.el (avy-lead-face-2): New face. (avy-lead-faces): New defconst. Each element will be used to color the corresponding depth. (avy--overlay-at-full): Use `avy-lead-faces' to represent the current decision depth. For `de-bruijn', prepend the old stuff, so that nothing moves. Fixes #53
This commit is contained in:
parent
6dfa445e07
commit
02bf35b6a0
24
avy.el
24
avy.el
@ -142,6 +142,10 @@ Typically, these modes don't use the text representation.")
|
|||||||
'((t (:foreground "white" :background "gray")))
|
'((t (:foreground "white" :background "gray")))
|
||||||
"Face used for matched leading chars.")
|
"Face used for matched leading chars.")
|
||||||
|
|
||||||
|
(defface avy-lead-face-2
|
||||||
|
'((t (:foreground "white" :background "#f86bf3")))
|
||||||
|
"Face used for leading chars.")
|
||||||
|
|
||||||
(defface avy-lead-face
|
(defface avy-lead-face
|
||||||
'((t (:foreground "white" :background "#e52b50")))
|
'((t (:foreground "white" :background "#e52b50")))
|
||||||
"Face used for the leading chars.")
|
"Face used for the leading chars.")
|
||||||
@ -150,6 +154,14 @@ Typically, these modes don't use the text representation.")
|
|||||||
'((t (:foreground "gray40")))
|
'((t (:foreground "gray40")))
|
||||||
"Face for whole window background during selection.")
|
"Face for whole window background during selection.")
|
||||||
|
|
||||||
|
(defconst avy-lead-faces '(avy-lead-face
|
||||||
|
avy-lead-face-0
|
||||||
|
avy-lead-face-2
|
||||||
|
avy-lead-face
|
||||||
|
avy-lead-face-0
|
||||||
|
avy-lead-face-2)
|
||||||
|
"Face sequence for `avy--overlay-at-full'.")
|
||||||
|
|
||||||
;;* Internals
|
;;* Internals
|
||||||
;;** Tree
|
;;** Tree
|
||||||
(defmacro avy-multipop (lst n)
|
(defmacro avy-multipop (lst n)
|
||||||
@ -566,8 +578,16 @@ LEAF is normally ((BEG . END) . WND)."
|
|||||||
(car leaf)))
|
(car leaf)))
|
||||||
(wnd (cdr leaf))
|
(wnd (cdr leaf))
|
||||||
oov)
|
oov)
|
||||||
(when (or avy-highlight-first (> (length str) 1))
|
(dotimes (i len)
|
||||||
(set-text-properties 0 1 '(face avy-lead-face-0) str))
|
(set-text-properties (- len i 1) (- len i)
|
||||||
|
`(face ,(nth i avy-lead-faces))
|
||||||
|
str))
|
||||||
|
(when (eq avy-style 'de-bruijn)
|
||||||
|
(setq str (concat
|
||||||
|
(propertize avy-current-path
|
||||||
|
'face 'avy-lead-face-1)
|
||||||
|
str))
|
||||||
|
(setq len (length str)))
|
||||||
(with-selected-window wnd
|
(with-selected-window wnd
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user