zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: local keymap handling in getkeymapcmd()
@ 2005-09-24 18:18 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2005-09-24 18:18 UTC (permalink / raw)
  To: zsh-workers

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)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-24 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-24 18:18 PATCH: local keymap handling in getkeymapcmd() Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).