Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bindkey -s problem in 3.1.1



-----BEGIN PGP SIGNED MESSAGE-----

Peter wrote:
>As far as I know, the user side of the zle code hasn't changed yet, but
>I'm having problems:
>
>bindkey -s "^X^L" "^@"
>
>should make "^X^L" do set-mark-command, but actually it produces a
>pound (sterling) sign on my keyboard.  The sequence bound to doesn't
>seem to matter.
>
>Is this a statement against European monetary union or a bug?

Ah, you've seen through my cunning plan!  Yes, I'm protesting against the
unimaginative bureaucrats at Brussels -- I can think of much better names
for a currency unit than "Euro".  And its symbol isn't even in Unicode...

There are actually two interacting bugs here, both in the new keymap code.
(I knew it was looking too good to be true.)  Firstly, when a send-string
is pushed back, the start of the metafied string is pushed back, rather
than the string itself.  In this case, given the string "\0", the string
"\203" (correct length prefix of "\203 ") is being pushed back.

Secondly, when a metafiable character is read from the input buffer,
the variable c (used in self-insert) is being set to the last character
of the metafied form of the string being read, rather than the last
character read.  In this case, when "\203" is read, it is metafied as
"\203\243", and c is set to '\243', which just happens to be the sterling
sign in Latin-1.

 -zefram

      *** Src/Zle/zle_keymap.c	1997/01/29 03:25:45	1.8
      --- Src/Zle/zle_keymap.c	1997/03/04 02:06:16
      ***************
      *** 1146,1154 ****
        	keybuf = realloc(keybuf, keybufsz *= 2);
            if(imeta(c)) {
        	keybuf[keybuflen++] = Meta;
      ! 	c ^= 32;
      !     }
      !     keybuf[keybuflen++] = c;
            keybuf[keybuflen] = 0;
            return c;
        }
      --- 1146,1154 ----
        	keybuf = realloc(keybuf, keybufsz *= 2);
            if(imeta(c)) {
        	keybuf[keybuflen++] = Meta;
      ! 	keybuf[keybuflen++] = c ^ 32;
      !     } else
      ! 	keybuf[keybuflen++] = c;
            keybuf[keybuflen] = 0;
            return c;
        }
      ***************
      *** 1187,1193 ****
        	    return NULL;
        	}
        	pb = unmetafy(ztrdup(str), &len);
      ! 	ungetkeys(str, len);
        	zfree(pb, strlen(str) + 1);
        	goto sentstring;
            }
      --- 1187,1193 ----
        	    return NULL;
        	}
        	pb = unmetafy(ztrdup(str), &len);
      ! 	ungetkeys(pb, len);
        	zfree(pb, strlen(str) + 1);
        	goto sentstring;
            }

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMxuHDXD/+HJTpU/hAQHKaQP8CEk9Sc8F31ZoeE1j6utDbvUfPaQCcFWF
fMoKeRjgWMjramOuMTxa9zgLArhAJxZdb4bQwV7o7+5YMLkjmSCJBWbiQNOaLKhJ
OfyhR/iPzSszh/qXWuDoDBO5HwtR25g7DAeoEhex6pHbXBMwoey3MR9b2cZCei4h
4YWhnngj70I=
=4OGw
-----END PGP SIGNATURE-----



Messages sorted by: Reverse Date, Date, Thread, Author