diff options
author | Bob Weiner <rsw@gnu.org> | 2017-12-08 15:20:41 -0500 |
---|---|---|
committer | Oleh Krehel <ohwoeowho@gmail.com> | 2017-12-11 18:17:48 +0100 |
commit | 9489ca906481e1584cc4c53e9e607f98c3a14378 (patch) | |
tree | 0f33fd46684a2a22a8bf5bec728016b9c0744992 | |
parent | 793a5e22a7ea89c4c6d96422609cdb2b3121dd3d (diff) |
Add window selection via mouse button press and fix typo
-rw-r--r-- | avy.el | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -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." |