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

PATCH: local keymap handling in getkeymapcmd()



The test was somewhat broken for whether a key sequence was a prefix of a
sequence in the local map.  Before the patch below, the effect was that a
sequence had to be a prefix in the current global map as well as in the
local map before it would be handled properly in the local map.

Index: Src/Zle/zle_keymap.c
===================================================================
diff -c -r1.10 zle_keymap.c
--- Src/Zle/zle_keymap.c	24 Sep 2005 17:48:38 -0000	1.10
+++ Src/Zle/zle_keymap.c	24 Sep 2005 18:10:46 -0000
@@ -1293,19 +1293,25 @@
     while(getkeybuf(!!lastlen) != EOF) {
 	char *s;
 	Thingy f;
-	int loc = 1;
+	int loc = !!localkeymap;
+	int ispfx = 0;
 
-	if (!localkeymap ||
-	    (f = keybind(localkeymap, keybuf, &s)) == t_undefinedkey)
-	    loc = 0, f = keybind(km, keybuf, &s);
+	if (loc) {
+	    loc = ((f = keybind(localkeymap, keybuf, &s)) != t_undefinedkey);
+	    ispfx = keyisprefix(localkeymap, keybuf);
+	}
+	if (!loc && !ispfx) {
+	    f = keybind(km, keybuf, &s);
+	    ispfx = keyisprefix(km, keybuf);
+	}
 
-	if(f != t_undefinedkey) {
+	if (f != t_undefinedkey) {
 	    lastlen = keybuflen;
 	    func = f;
 	    str = s;
 	    lastc = lastchar;
 	}
-	if(!keyisprefix((loc ? localkeymap : km), keybuf))
+	if (!ispfx)
 	    break;
     }
     if(!lastlen && keybuflen)



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