about summary refs log tree commit diff
path: root/exwm-input.el
diff options
context:
space:
mode:
authorChris Feng <chris.w.feng@gmail.com>2015-08-05T06·10+0800
committerChris Feng <chris.w.feng@gmail.com>2015-08-05T06·10+0800
commit3fc0cb2bf7e97a525862e95052aaffca70b2089e (patch)
treeeb8f302a88334e7bbb05626537935d1c3304efdd /exwm-input.el
parentee3ce55c4834f9925d5f349e182eb68a3c1c0365 (diff)
Various fixes
* Prevent marking the end of a key sequence with a single `C-u'.
* Enable `C-u' prefix for key simulation since it's not possible for users to
  define simulation keys starting with `C-u'.
* Make Emacs idle only after the visual parts are updated to prevent from
  disturbing users.
* Should use '?\s' instead of '? '.
Diffstat (limited to 'exwm-input.el')
-rw-r--r--exwm-input.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/exwm-input.el b/exwm-input.el
index e185b1af1486..6d72cc26a004 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -108,10 +108,12 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
 
 (defun exwm-input--finish-key-sequence ()
   "Mark the end of a key sequence (with the aid of `pre-command-hook')."
-  (setq exwm-input--during-key-sequence nil)
-  (when exwm-input--temp-line-mode
-    (setq exwm-input--temp-line-mode nil)
-    (exwm-input--release-keyboard)))
+  (when (and exwm-input--during-key-sequence
+             (not (equal [?\C-u] (this-single-command-keys))))
+    (setq exwm-input--during-key-sequence nil)
+    (when exwm-input--temp-line-mode
+      (setq exwm-input--temp-line-mode nil)
+      (exwm-input--release-keyboard))))
 
 (defun exwm-input--on-MappingNotify (data synthetic)
   "Handle MappingNotify event."
@@ -403,18 +405,19 @@ SIMULATION-KEYS is a list of alist (key-sequence1 . key-sequence2)."
     (cl-pushnew `(,(vconcat (car i)) . ,(cdr i)) exwm-input--simulation-keys))
   (exwm-input--update-simulation-prefix-keys))
 
-(defun exwm-input-send-simulation-key ()
+(defun exwm-input-send-simulation-key (times)
   "Fake a key event according to last input key sequence."
-  (interactive)
-  (let ((pair (assoc (this-command-keys-vector) ;FIXME: pefix
+  (interactive "p")
+  (let ((pair (assoc (this-single-command-keys)
                      exwm-input--simulation-keys))
         key)
     (when pair
       (setq pair (cdr pair))
       (unless (listp pair)
         (setq pair (list pair)))
-      (dolist (i pair)
-        (exwm-input--fake-key i)))))
+      (dotimes (i times)
+        (dolist (j pair)
+          (exwm-input--fake-key j))))))
 
 (defun exwm-input--init ()
   "Initialize the keyboard module."