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

completion bugfix



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

There's a bug in completion that can cause the cursor to be moved one
character before the start of the word being completed.  At the beginning
of the buffer, this can cause a crash.  Try:

% ;""

Put the cursor on the first quote, and press <tab>.  The cursor moves
before the semicolon.

The following patch fixes this bug.  I *think* that's all it does; the
old code *looks* wrong, but the logic in that function is quite opaque
so I'm not 100% certain.  If anyone knows better, please say so.

 -zefram

      Index: Src/zle_tricky.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/zle_tricky.c,v
      retrieving revision 1.45
      diff -c -r1.45 zle_tricky.c
      *** zle_tricky.c	1996/11/09 13:29:17	1.45
      --- zle_tricky.c	1996/11/15 02:29:14
      ***************
      *** 1103,1109 ****
        			cs = i;
        			foredel(1);
        			chuck(tt--);
      ! 			if ((cs = ocs) >= i--)
        			    cs--;
        			we--;
        		    }
      --- 1103,1109 ----
        			cs = i;
        			foredel(1);
        			chuck(tt--);
      ! 			if ((cs = ocs) > i--)
        			    cs--;
        			we--;
        		    }

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

iQCVAwUBMovW5XD/+HJTpU/hAQHkrgP/cANoQu2HZBBjGC6XXrsvHotSi9c3/0PG
MLJTWYaxEAoBvhrZp33N8IFvH9fBE1vmXbC8WY2/CVVjoqfh569COzrGNEcUic0P
LOiqh2NY0sn+lFf/Fqvp5HkbRR8p9sbyPS/PVDC9VuB64FMpO7SPPZID0YIPVa4j
pf/V0z1m7uw=
=tsaL
-----END PGP SIGNATURE-----



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