zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@dcs.warwick.ac.uk>
To: hzoli@cs.elte.hu (Zoltan Hidvegi)
Cc: zsh-workers@math.gatech.edu
Subject: Re: bindkey bug?
Date: Sat, 14 Dec 1996 18:15:16 +0000 (GMT)	[thread overview]
Message-ID: <27598.199612141815@stone.dcs.warwick.ac.uk> (raw)
In-Reply-To: <199612140329.EAA05233@hzoli.ppp.cs.elte.hu> 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-----


      parent reply	other threads:[~1996-12-15  1:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-14  3:29 Zoltan Hidvegi
1996-12-14  5:00 ` Bart Schaefer
1996-12-14 22:19   ` Zoltan Hidvegi
1996-12-14 18:15 ` Zefram [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27598.199612141815@stone.dcs.warwick.ac.uk \
    --to=zefram@dcs.warwick.ac.uk \
    --cc=hzoli@cs.elte.hu \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).