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

PATCH: give precedence to local keymaps (was Re: More on getkeycmd())



I'd like to back out the change in 21770:

At the time, on 27 Sep 2005, Bart wrote:
> It occurred to me that the patch I posted in 21760 causes longer bindings
> in the local map to hide prefixes in the global map.  That's probably not
> the desired behavior; the change would be as follows.  Should this get
> committed also?

I find in practice that this hiding is my desired behaviour. The
alternative is shorter bindings in the global map hiding longer ones in
the local map. If you want to preserve the global binding, simply don't
bind longer ones in the local map. The other way around tends to be less
possible because the global map has a wider purpose.

Oliver

diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 2e54e7f..e21e769 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1435,10 +1435,9 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
 	    loc = ((f = keybind(localkeymap, keybuf, &s)) != t_undefinedkey);
 	    ispfx = keyisprefix(localkeymap, keybuf);
 	}
-	if (!loc && !ispfx) {
+	if (!loc)
 	    f = keybind(km, keybuf, &s);
-	    ispfx = keyisprefix(km, keybuf);
-	}
+	ispfx |= keyisprefix(km, keybuf);
 
 	if (f != t_undefinedkey) {
 	    lastlen = keybuflen;



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