[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8efed40 20/36: Add `avy-lead-face-1' for dimmed matched ch
From: |
Oleh Krehel |
Subject: |
[elpa] master 8efed40 20/36: Add `avy-lead-face-1' for dimmed matched chars |
Date: |
Tue, 19 May 2015 12:38:14 +0000 |
branch: master
commit 8efed4072a9b17ec89db73c56995d95a4891f49f
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add `avy-lead-face-1' for dimmed matched chars
* avy.el (avy-lead-face-0): Update doc.
(avy-lead-face-1): New face.
(avy-current-path): New defvar.
(avy-read): Store the current matched chars in `avy-current-path'.
(avy--overlay-pre):
(avy--overlay-post): Extend the string with the matched part. This
prevents shifting during selection, and looks nice too.
Fixes #38
---
avy.el | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/avy.el b/avy.el
index 84a2c34..f676b77 100644
--- a/avy.el
+++ b/avy.el
@@ -127,7 +127,11 @@ When nil, punctuation chars will not be matched.
(defface avy-lead-face-0
'((t (:foreground "white" :background "#4f57f9")))
- "Face used for the leading chars.")
+ "Face used for first non-terminating leading chars.")
+
+(defface avy-lead-face-1
+ '((t (:foreground "white" :background "gray")))
+ "Face used for matched leading chars.")
(defface avy-lead-face
'((t (:foreground "white" :background "#e52b50")))
@@ -208,6 +212,9 @@ KEYS is the path from the root of `avy-tree' to LEAF."
(defvar avy-handler-function 'avy-handler-default
"A function to call for a bad `read-char' in `avy-read'.")
+(defvar avy-current-path ""
+ "Store the current incomplete path during `avy-read'.")
+
(defun avy-read (tree display-fn cleanup-fn)
"Select a leaf from TREE using consecutive `read-char'.
@@ -218,6 +225,7 @@ commonly done by adding a CHAR overlay at LEAF position.
CLEANUP-FN should take no arguments and remove the effects of
multiple DISPLAY-FN invokations."
(catch 'done
+ (setq avy-current-path "")
(while tree
(let ((avy--leafs nil))
(avy-traverse tree
@@ -230,7 +238,9 @@ multiple DISPLAY-FN invokations."
(funcall cleanup-fn)
(if (setq branch (assoc char tree))
(if (eq (car (setq tree (cdr branch))) 'leaf)
- (throw 'done (cdr tree)))
+ (throw 'done (cdr tree))
+ (setq avy-current-path
+ (concat avy-current-path (string char))))
(funcall avy-handler-function char))))))
;;** Rest
@@ -372,6 +382,10 @@ LEAF is normally ((BEG . END) . WND)."
'face 'avy-lead-face)))
(when (> (length str) 1)
(set-text-properties 0 1 '(face avy-lead-face-0) str))
+ (setq str (concat
+ (propertize avy-current-path
+ 'face 'avy-lead-face-1)
+ str))
(avy--overlay
str
(cond ((numberp leaf)
@@ -456,6 +470,10 @@ LEAF is normally ((BEG . END) . WND)."
'face 'avy-lead-face)))
(when (> (length str) 1)
(set-text-properties 0 1 '(face avy-lead-face-0) str))
+ (setq str (concat
+ (propertize avy-current-path
+ 'face 'avy-lead-face-1)
+ str))
(avy--overlay
str
(cond ((numberp leaf)
- [elpa] master a08b049 04/36: Fix jumping to newlines with at-full style, (continued)
- [elpa] master a08b049 04/36: Fix jumping to newlines with at-full style, Oleh Krehel, 2015/05/19
- [elpa] master eed8f6f 15/36: avy.el (avy--regex-candidates): Add optional group arg, Oleh Krehel, 2015/05/19
- [elpa] master 0d83599 16/36: Update group name, Oleh Krehel, 2015/05/19
- [elpa] master ca69b1f 14/36: Add debug declarations, Oleh Krehel, 2015/05/19
- [elpa] master a53ffb7 05/36: Allow to break from `avy-goto-line' into `goto-line', Oleh Krehel, 2015/05/19
- [elpa] master ca302b4 08/36: targets/avy-init.el: Move, Oleh Krehel, 2015/05/19
- [elpa] master b0512fc 21/36: avy.el (avy--overlay-at): Use `avy--overlay-offset', Oleh Krehel, 2015/05/19
- [elpa] master 04d26c4 07/36: avy-jump.el (avy-case-fold-search): New defcustom, Oleh Krehel, 2015/05/19
- [elpa] master b602a56 17/36: Stop 'at-full from shifting text, Oleh Krehel, 2015/05/19
- [elpa] master ea6f5c5 25/36: Customize how `avy-lead-face-0' is applied, Oleh Krehel, 2015/05/19
- [elpa] master 8efed40 20/36: Add `avy-lead-face-1' for dimmed matched chars,
Oleh Krehel <=
- [elpa] master 410c4ac 11/36: Merge avy-jump.el into avy.el, Oleh Krehel, 2015/05/19
- [elpa] master 7433f30 18/36: With 'at-full style, use full len to check for overlap, Oleh Krehel, 2015/05/19
- [elpa] master f0694a2 23/36: Remove empty line after original one being moved, Oleh Krehel, 2015/05/19
- [elpa] master 1127467 24/36: avy.el (avy-move-line): Use ARG lines, Oleh Krehel, 2015/05/19
- [elpa] master 2e936d8 10/36: avy-jump.el (avy-goto-word-or-subword-1): New command, Oleh Krehel, 2015/05/19
- [elpa] master e35f1ed 19/36: Use `avy-lead-face-0' for 'pre and 'post, Oleh Krehel, 2015/05/19
- [elpa] master a39f689 22/36: Allow all kinds of styles for `avy-goto-line', Oleh Krehel, 2015/05/19
- [elpa] master 92a7884 32/36: avy.el (avy-window-list): Fixup last commit, Oleh Krehel, 2015/05/19
- [elpa] master a4f4015 33/36: avy.el (avy--overlay-at-full): Check overlay window, Oleh Krehel, 2015/05/19
- [elpa] master dc06220 29/36: Fix the at-full style interaction with tabs, Oleh Krehel, 2015/05/19