about summary refs log tree commit diff
path: root/Src/Zle/zle_keymap.c
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 /Src/Zle/zle_keymap.c
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()
Diffstat (limited to 'Src/Zle/zle_keymap.c')
-rw-r--r--Src/Zle/zle_keymap.c18
1 files changed, 12 insertions, 6 deletions
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)