mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-27 13:07:59 +01:00
Support key translation in line-mode
* exwm-input.el (exwm-input--translate): New function for translating keys according to `input-decode-map', `local-function-key-map' and `key-translation-map'. (exwm-input--cache-event): Use it.
This commit is contained in:
parent
895633fe61
commit
6b4bfad87b
1 changed files with 15 additions and 0 deletions
|
@ -471,10 +471,25 @@ This value should always be overwritten.")
|
|||
(defvar exwm-input--temp-line-mode nil
|
||||
"Non-nil indicates it's in temporary line-mode for char-mode.")
|
||||
|
||||
(cl-defun exwm-input--translate (key)
|
||||
(let (translation)
|
||||
(dolist (map (list input-decode-map
|
||||
local-function-key-map
|
||||
key-translation-map))
|
||||
(setq translation (lookup-key map key))
|
||||
(if (functionp translation)
|
||||
(cl-return-from exwm-input--translate (funcall translation nil))
|
||||
(when (vectorp translation)
|
||||
(cl-return-from exwm-input--translate translation)))))
|
||||
key)
|
||||
|
||||
(defun exwm-input--cache-event (event)
|
||||
"Cache EVENT."
|
||||
(setq exwm-input--line-mode-cache
|
||||
(vconcat exwm-input--line-mode-cache (vector event)))
|
||||
;; Attempt to translate this key sequence.
|
||||
(setq exwm-input--line-mode-cache
|
||||
(exwm-input--translate exwm-input--line-mode-cache))
|
||||
;; When the key sequence is complete.
|
||||
(unless (keymapp (key-binding exwm-input--line-mode-cache))
|
||||
(setq exwm-input--line-mode-cache nil)
|
||||
|
|
Loading…
Reference in a new issue