Add option to match newline in avy-goto-char-timer

Fixes #220
Fixes #225
This commit is contained in:
Nir Friedman 2017-11-25 18:23:16 -05:00 committed by Oleh Krehel
parent 9103291214
commit c08fc7c1c6

8
avy.el
View File

@ -1768,6 +1768,10 @@ newline."
"How many seconds to wait for the second char." "How many seconds to wait for the second char."
:type 'float) :type 'float)
(defcustom avy-enter-times-out t
"Whether enter exits avy-goto-char-timer early. If nil it matches newline"
:type 'boolean)
(defun avy--read-candidates (&optional re-builder) (defun avy--read-candidates (&optional re-builder)
"Read as many chars as possible and return their occurences. "Read as many chars as possible and return their occurences.
At least one char must be read, and then repeatedly one next char At least one char must be read, and then repeatedly one next char
@ -1802,7 +1806,9 @@ Otherwise, the whole regex is highlighted."
(cond (cond
;; Handle RET ;; Handle RET
((= char 13) ((= char 13)
(setq break t)) (if avy-enter-times-out
(setq break t)
(setq str (concat str (list ?\n)))))
;; Handle C-h, DEL ;; Handle C-h, DEL
((memq char '(8 127)) ((memq char '(8 127))
(let ((l (length str))) (let ((l (length str)))