zsh-workers
 help / color / mirror / code / Atom feed
* bindkey bug?
@ 1996-12-14  3:29 Zoltan Hidvegi
  1996-12-14  5:00 ` Bart Schaefer
  1996-12-14 18:15 ` Zefram
  0 siblings, 2 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1996-12-14  3:29 UTC (permalink / raw)
  To: Zsh hacking and development

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?

Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bindkey bug?
  1996-12-14  3:29 bindkey bug? Zoltan Hidvegi
@ 1996-12-14  5:00 ` Bart Schaefer
  1996-12-14 22:19   ` Zoltan Hidvegi
  1996-12-14 18:15 ` Zefram
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 1996-12-14  5:00 UTC (permalink / raw)
  To: Zoltan Hidvegi, Zsh hacking and development

On Dec 14,  4:29am, Zoltan Hidvegi wrote:
} Subject: bindkey bug?
}
} 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?

Are you sure it's ^Z that zsh thinks is a prefix?  I'd be more suspicious
that it thinks that the leading ESC in the expansion is a prefix.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bindkey bug?
  1996-12-14  3:29 bindkey bug? Zoltan Hidvegi
  1996-12-14  5:00 ` Bart Schaefer
@ 1996-12-14 18:15 ` Zefram
  1 sibling, 0 replies; 4+ messages in thread
From: Zefram @ 1996-12-14 18:15 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers

-----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-----


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bindkey bug?
  1996-12-14  5:00 ` Bart Schaefer
@ 1996-12-14 22:19   ` Zoltan Hidvegi
  0 siblings, 0 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1996-12-14 22:19 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

> } 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.
[...]
> Are you sure it's ^Z that zsh thinks is a prefix?  I'd be more suspicious
> that it thinks that the leading ESC in the expansion is a prefix.

I am sure.  I checked that bindtab['^Z'] == z_prefix.  And I think it is
inroduced after Zefram's changes so zsh-3.0.2 does not have this bug.

Zoltan


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-12-15  1:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-14  3:29 bindkey bug? Zoltan Hidvegi
1996-12-14  5:00 ` Bart Schaefer
1996-12-14 22:19   ` Zoltan Hidvegi
1996-12-14 18:15 ` Zefram

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).