Allow "C-h" to delete for avy-goto-char-timer

Fixes #193
This commit is contained in:
ketanaka 2017-04-11 21:09:29 +09:00 committed by Oleh Krehel
parent 105efc8482
commit f2bedeeb58

12
avy.el
View File

@ -1625,10 +1625,10 @@ saves the line(s) as if killed, but does not kill it(them)."
(defun avy--read-candidates () (defun avy--read-candidates ()
"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
may be read if it is entered before `avy-timeout-seconds'. `DEL' may be read if it is entered before `avy-timeout-seconds'. `C-h'
deletes the last char entered, and `RET' exits with the currently or `DEL' deletes the last char entered, and `RET' exits with the
read string immediately instead of waiting for another char for currently read string immediately instead of waiting for another
`avy-timeout-seconds'. char for `avy-timeout-seconds'.
The format of the result is the same as that of `avy--regex-candidates'. The format of the result is the same as that of `avy--regex-candidates'.
This function obeys `avy-all-windows' setting." This function obeys `avy-all-windows' setting."
(let ((str "") char break overlays regex) (let ((str "") char break overlays regex)
@ -1651,8 +1651,8 @@ This function obeys `avy-all-windows' setting."
;; Handle RET ;; Handle RET
((= char 13) ((= char 13)
(setq break t)) (setq break t))
;; Handle DEL ;; Handle C-h, DEL
((= char 127) ((memq char '(8 127))
(let ((l (length str))) (let ((l (length str)))
(when (>= l 1) (when (>= l 1)
(setq str (substring str 0 (1- l)))))) (setq str (substring str 0 (1- l))))))