about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2005-09-24 18:49:42 +0000
committerBart Schaefer <barts@users.sourceforge.net>2005-09-24 18:49:42 +0000
commit5f076d1390bba5a4da13b79e6513839dd848fc9b (patch)
treeab577f153bc59221b3c63a923fa5472bd2c27619
parent8d6cd1dc94f985e98a794d7e8d9f23ebe0b6d7e6 (diff)
downloadzsh-5f076d1390bba5a4da13b79e6513839dd848fc9b.tar.gz
zsh-5f076d1390bba5a4da13b79e6513839dd848fc9b.tar.xz
zsh-5f076d1390bba5a4da13b79e6513839dd848fc9b.zip
21760: fix test for sequence prefixes in the local keymap in getkeymapcmd()
-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)