Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: big key binding patch

In archive/latest/2472, Zefram wrote:
> That'll teach me to assume that someone else was mistaken.  The code I
> replaced had HashTable *'s in that list, and extra dereferences.

That'll teach me to put the rationale for such hacks into comments.
Don't you appreciate patches sent in by wannabe hackers from all
over the world?

Anyway, with Zefram's patch, which is sure impressive, I'm experi-
encing core dumps in vi mode.  Let's say, I'm pressing those keys in
an xterm: Cursor-up, cursor-down, cursor-up, ie.

  ~/wrk/z/zsh-3.1.0-test3/Src> <ESC>[A<ESC>[B<ESC>[A
  Program received signal SIGSEGV, Segmentation fault.
  0x8098b2b in getkeycmd () at zle_main.c:542
  542             if (cky->func == z_undefinedkey)
  (gdb) [A
Now, after two feep()s and the third key-press, the prefix is recog-
nized, but there's no binding for it in keybindtab (== vikeybindtab),
dereferencing cky (== NULL).  The easy way out is to add the default
cursor key bindings also to vi insert mode. 

[ In a similar vain, what exactly happens to meta-bindings like "\M-x"
  after `bindkey -m'? They're displayed as "^[x", and `bindkey -{a,v}m'
  makes them look like (*iso8859-1 alert*) "ø".  They're working OK,
  albeit difficult to locate on my keyboard. ]


--- zle_main.c	1996/11/24 18:16:15	2.33
+++ zle_main.c	1996/11/25 18:11:40
@@ -687,6 +687,12 @@
     addbinding(altbindtab, altkeybindtab, "\33[A", 3, z_uplineorhistory);
     addbinding(altbindtab, altkeybindtab, "\33[B", 3, z_downlineorhistory);
+    /* vi insert mode: arrow keys */
+    addbinding(vibindtab, vikeybindtab, "\33[C", 3, z_forwardchar);
+    addbinding(vibindtab, vikeybindtab, "\33[D", 3, z_backwardchar);
+    addbinding(vibindtab, vikeybindtab, "\33[A", 3, z_uplineorhistory);
+    addbinding(vibindtab, vikeybindtab, "\33[B", 3, z_downlineorhistory);
     /* emacs mode: arrow keys */
     addbinding(embindtab, emkeybindtab, "\33[C", 3, z_forwardchar);
     addbinding(embindtab, emkeybindtab, "\33[D", 3, z_backwardchar);

Messages sorted by: Reverse Date, Date, Thread, Author