[Vimpulse] Arrow keys don't work as motions

Nick Smallbone nick.smallbone at gmail.com
Sat Aug 21 23:40:30 CEST 2010


Hi Vegard,

Vegard Øye <vegard_oye at hotmail.com> writes:
> This should be fixed in commit [9d7095a742]. Vimpulse compares the key
> sequence as a string against shortcuts like "g??", but not all key
> sequences can be represented as strings. String conversion can only
> work if all the elements in the sequence are characters (i.e.,
> integers). If not, we have to use vector format instead.

Thanks for the quick response. I also mentioned another problem, that
y 2 right didn't work, that I've since managed to fix. The bug was in
vimpulse-keypress-parser: there's a variable 'digit that gets set when
you type a prefix argument (2 in this case). It's supposed to get reset
once you type the next character, but this only happens if the next
character is an ASCII character, and as a result if you type in a
non-ASCII character it gets accidentally treated as a prefix
argument instead. Here is a patch to fix it.

Nick

diff --git a/vimpulse-operator.el b/vimpulse-operator.el
index 178e6cd..27af4d2 100644
--- a/vimpulse-operator.el
+++ b/vimpulse-operator.el
@@ -350,8 +350,9 @@ (defun vimpulse-keypress-parser (&optional no-remap)
                  (setq char (or (get char 'ascii-character) char))))
              ;; This trick from simple.el's `digit-argument'
              ;; converts keystrokes like C-0 and C-M-1 to digits.
-             (when (characterp char)
-               (setq digit (- (logand char ?\177) ?0)))
+             (if (integerp char)
+               (setq digit (- (logand char ?\177) ?0))
+               (setq digit nil))
              (if (keymapp cmd)
                  (setq keys (vconcat keys (vector char)))
                (setq keys (vector char)))





More information about the implementations-list mailing list