Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bindkey bug?
- X-seq: zsh-workers 2583
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: hzoli@xxxxxxxxxx (Zoltan Hidvegi)
- Subject: Re: bindkey bug?
- Date: Sat, 14 Dec 1996 18:15:16 +0000 (GMT)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <199612140329.EAA05233@xxxxxxxxxxxxxxxxxxxx> from "Zoltan Hidvegi" at Dec 14, 96 04:29:41 am
-----BEGIN PGP SIGNED MESSAGE-----
Zoltan Hidvegi wrote:
>I have this bindkey in my .zshrc:
>
>bindkey -s '^Z' '^[Qfg^M'
>
>In recent zsh versions after this command zsh thinks that ^Z is a prefix
>and waits a half second before executing the string. That did not happen
>in zsh-3.0.0.
>
>Does any of you know exactly which caused this changed?
It was a side-effect of my key binding patch. The replacement string
can't be stored in the simple key table, so ^Z has to be treated as a
prefix. Of course, its prefixct is 0, indicating that it's not really
a prefix. The bug is that getkeycmd() doesn't check prefixct soon
enough. This totally untested patch should fix it:
*** zle_main.c.old Sat Dec 14 17:59:26 1996
--- zle_main.c Sat Dec 14 18:10:22 1996
***************
*** 536,542 ****
Key ky;
metafy_keybuf();
! cky = (Key) keybindtab->getnode(keybindtab, keybuf);
unmetafy(keybuf, NULL);
if (cky->func == z_undefinedkey)
--- 536,542 ----
Key ky;
metafy_keybuf();
! ky = cky = (Key) keybindtab->getnode(keybindtab, keybuf);
unmetafy(keybuf, NULL);
if (cky->func == z_undefinedkey)
***************
*** 543,549 ****
cky = NULL;
else
lastlen = 1;
! for (;;) {
if ((c = getkey(!!cky)) >= 0) {
keybuf[keybuflen++] = c;
metafy_keybuf();
--- 543,549 ----
cky = NULL;
else
lastlen = 1;
! while(ky->prefixct) {
if ((c = getkey(!!cky)) >= 0) {
keybuf[keybuflen++] = c;
metafy_keybuf();
***************
*** 555,575 ****
if (ky->func == z_undefinedkey)
continue;
cky = ky;
- if (!ky->prefixct) {
- ret = ky->func;
- break;
- }
lastlen = keybuflen;
} else if (cky) {
ungetkeys(keybuf + lastlen, keybuflen - lastlen);
if(vichgflag)
vichgbufptr -= keybuflen - lastlen;
- ret = cky->func;
c = keybuf[lastlen - 1];
break;
} else
return z_undefinedkey;
}
}
if (ret == z_executenamedcmd && !statusline) {
while(ret == z_executenamedcmd)
--- 555,571 ----
if (ky->func == z_undefinedkey)
continue;
cky = ky;
lastlen = keybuflen;
} else if (cky) {
ungetkeys(keybuf + lastlen, keybuflen - lastlen);
if(vichgflag)
vichgbufptr -= keybuflen - lastlen;
c = keybuf[lastlen - 1];
break;
} else
return z_undefinedkey;
}
+ ret = cky->func;
}
if (ret == z_executenamedcmd && !statusline) {
while(ret == z_executenamedcmd)
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: ascii
iQCVAwUBMrLum3D/+HJTpU/hAQEfvAP/SpC2GUKcoLkQUgti7fZKdAVw8FmBYELm
j/49ff5lKLxQPI3ONAzTB0X2NFAdaGyuzC9ooDbwKRryQ1XLDOQUhrW4Axbwo+7E
pehSN6KrgE0aJ1H+Hkt83TQWwDO6hLRk/m4IzaNQD3gfY0FDRYztEe7HLKgF3HfG
ApUlKBqoBww=
=BI3q
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author