about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_keymap.c18
2 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index db7909dd9..1664bac08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
-2005-09-24  Bart Schaefer  <schaefer@brasslantern.com>
+2005-09-24  Bart Schaefer  <schaefer@zsh.org>
+
+	* 21760: Src/Zle/zle_keymap.c: fix test for sequence prefixes
+	in the local keymap in getkeymapcmd().
 
 	* unposted: Functions/Misc/zargs: add range-checking of numeric
 	options.
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 376805549..de1d918ba 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1293,19 +1293,25 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
     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)