branch: master
commit 9489ca906481e1584cc4c53e9e607f98c3a14378
Author: Bob Weiner <[email protected]>
Commit: Oleh Krehel <[email protected]>
Add window selection via mouse button press and fix typo
---
avy.el | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/avy.el b/avy.el
index 4fcbf96..6d427ef 100644
--- a/avy.el
+++ b/avy.el
@@ -465,15 +465,19 @@ multiple DISPLAY-FN invocations."
(dolist (x avy--leafs)
(funcall display-fn (car x) (cdr x))))
(let ((char (funcall avy-translate-char-function (read-key)))
+ window
branch)
(funcall cleanup-fn)
- (if (setq branch (assoc char tree))
- (progn
- (setq avy-current-path
- (concat avy-current-path (string (avy--key-to-char char))))
- (when (eq (car (setq tree (cdr branch))) 'leaf)
- (throw 'done (cdr tree))))
- (funcall avy-handler-function char))))))
+ (if (setq window (avy-mouse-event-window char))
+ (throw 'done (cons char window))
+ ;; Ensure avy-current-path stores the full path given before
+ ;; exit for testing when an invalid path character is given.
+ (setq avy-current-path
+ (concat avy-current-path (string (avy--key-to-char char))))
+ (if (setq branch (assoc char tree))
+ (if (eq (car (setq tree (cdr branch))) 'leaf)
+ (throw 'done (cdr tree)))
+ (funcall avy-handler-function char)))))))
(defun avy-read-de-bruijn (lst keys)
"Select from LST dispatching on KEYS."