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

Updated history expansion patch



I thought I had sent this to the list, but it hasn't appeared here.
Sorry if you get it twice.

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

The patch below is an updated version of my history reference
infinite-loop bug fix (message 30), which wasn't in beta10.  This
version of the patch is made after the history/input patch and my
completion patch, but should only depend on the former.  I think it
will apply with fuzz even if that patch hasn't been applied.

The update is not a change in functionality; I simply found that the
old patch won't apply to the new source.

 -zefram

      *** Src/zle_tricky.c.old	Wed Jul  5 02:37:32 1995
      --- Src/zle_tricky.c	Wed Jul  5 02:50:56 1995
      ***************
      *** 957,963 ****
        	    im &= ~2;
        
        	/* We reached the end. */
      ! 	if (tok == ENDINPUT)
        	    break;
        	if (tok == BAR || tok == AMPER || tok == BARAMP ||
        	    tok == DBAR || tok == DAMPER)
      --- 957,963 ----
        	    im &= ~2;
        
        	/* We reached the end. */
      ! 	if (tok == ENDINPUT || tok == LEXERR)
        	    break;
        	if (tok == BAR || tok == AMPER || tok == BARAMP ||
        	    tok == DBAR || tok == DAMPER)
      ***************
      *** 1009,1017 ****
        	if (clwpos == i++ && addedx)
        	    chuck(&clwords[i - 1][((cs - wb - 1) >= sl) ?
        				  (sl - 1) : (cs - wb - 1)]);
      !     }
      !     while (tok != LEXERR && tok != ENDINPUT &&
      ! 	   (tok != SEPER || (zleparse && !tt0)));
            /* Calculate the number of words stored in the clwords array. */
            clwnum = (tt || !i) ? i : i - 1;
            zsfree(clwords[clwnum]);
      --- 1009,1016 ----
        	if (clwpos == i++ && addedx)
        	    chuck(&clwords[i - 1][((cs - wb - 1) >= sl) ?
        				  (sl - 1) : (cs - wb - 1)]);
      !     } while (tok != LEXERR && tok != ENDINPUT &&
      ! 	(tok != SEPER || (zleparse && !tt0)));
            /* Calculate the number of words stored in the clwords array. */
            clwnum = (tt || !i) ? i : i - 1;
            zsfree(clwords[clwnum]);
      ***************
      *** 1020,1026 ****
            lincmd = cp;
            linredir = rd;
        
      !     if (!t0 || t0 == ENDINPUT) {
        	/* There was no word (empty line). */
        	s = ztrdup("");
        	we = wb = cs;
      --- 1019,1025 ----
            lincmd = cp;
            linredir = rd;
        
      !     if (!t0 || t0 == ENDINPUT || t0 == LEXERR) {
        	/* There was no word (empty line). */
        	s = ztrdup("");
        	we = wb = cs;
      ***************
      *** 2930,2942 ****
        	noaliases = 1;
        	do {
        	    ctxtlex();
      ! 	    if (tok == ENDINPUT)
        		break;
        	    if (!first && tokstr && *tokstr)
        		addlinknode(foo, ztrdup(tokstr));
        	    first = 0;
      ! 	}
      ! 	while (tok != ENDINPUT);
        	noaliases = 0;
        	strinend();
        	inpop();
      --- 2929,2940 ----
        	noaliases = 1;
        	do {
        	    ctxtlex();
      ! 	    if (tok == ENDINPUT || tok == LEXERR)
        		break;
        	    if (!first && tokstr && *tokstr)
        		addlinknode(foo, ztrdup(tokstr));
        	    first = 0;
      ! 	} while (tok != ENDINPUT && tok != LEXERR);
        	noaliases = 0;
        	strinend();
        	inpop();
      ***************
      *** 3795,3802 ****
            noerrs = 1;
            do {
        	ctxtlex();
      !     }
      !     while (tok != ENDINPUT && zleparse);
            noerrs = ne;
            noaliases = 0;
            popheap();
      --- 3793,3799 ----
            noerrs = 1;
            do {
        	ctxtlex();
      !     } while (tok != ENDINPUT && tok != LEXERR && zleparse);
            noerrs = ne;
            noaliases = 0;
            popheap();
      ***************
      *** 3869,3875 ****
            do {
        	curlincmd = incmdpos;
        	ctxtlex();
      ! 	if (tok == ENDINPUT)
        	    break;
        	if (tok == STRING && curlincmd) {
        	    zsfree(s);
      --- 3866,3872 ----
            do {
        	curlincmd = incmdpos;
        	ctxtlex();
      ! 	if (tok == ENDINPUT || tok == LEXERR)
        	    break;
        	if (tok == STRING && curlincmd) {
        	    zsfree(s);
      ***************
      *** 3878,3884 ****
        	    cmdwe = ll + 1 - inbufct;
        	}
            }
      !     while (tok != ENDINPUT && zleparse);
            popheap();
            strinend();
            inpop();
      --- 3875,3881 ----
        	    cmdwe = ll + 1 - inbufct;
        	}
            }
      !     while (tok != ENDINPUT && tok != LEXERR && zleparse);
            popheap();
            strinend();
            inpop();
      *** Src/zle_tricky.c.old	Wed Jul  5 02:37:32 1995
      --- Src/zle_tricky.c	Wed Jul  5 02:52:03 1995
      ***************
      *** 957,963 ****
        	    im &= ~2;
        
        	/* We reached the end. */
      ! 	if (tok == ENDINPUT)
        	    break;
        	if (tok == BAR || tok == AMPER || tok == BARAMP ||
        	    tok == DBAR || tok == DAMPER)
      --- 957,963 ----
        	    im &= ~2;
        
        	/* We reached the end. */
      ! 	if (tok == ENDINPUT || tok == LEXERR)
        	    break;
        	if (tok == BAR || tok == AMPER || tok == BARAMP ||
        	    tok == DBAR || tok == DAMPER)
      ***************
      *** 1009,1017 ****
        	if (clwpos == i++ && addedx)
        	    chuck(&clwords[i - 1][((cs - wb - 1) >= sl) ?
        				  (sl - 1) : (cs - wb - 1)]);
      !     }
      !     while (tok != LEXERR && tok != ENDINPUT &&
      ! 	   (tok != SEPER || (zleparse && !tt0)));
            /* Calculate the number of words stored in the clwords array. */
            clwnum = (tt || !i) ? i : i - 1;
            zsfree(clwords[clwnum]);
      --- 1009,1016 ----
        	if (clwpos == i++ && addedx)
        	    chuck(&clwords[i - 1][((cs - wb - 1) >= sl) ?
        				  (sl - 1) : (cs - wb - 1)]);
      !     } while (tok != LEXERR && tok != ENDINPUT &&
      ! 	(tok != SEPER || (zleparse && !tt0)));
            /* Calculate the number of words stored in the clwords array. */
            clwnum = (tt || !i) ? i : i - 1;
            zsfree(clwords[clwnum]);
      ***************
      *** 1020,1026 ****
            lincmd = cp;
            linredir = rd;
        
      !     if (!t0 || t0 == ENDINPUT) {
        	/* There was no word (empty line). */
        	s = ztrdup("");
        	we = wb = cs;
      --- 1019,1025 ----
            lincmd = cp;
            linredir = rd;
        
      !     if (!t0 || t0 == ENDINPUT || t0 == LEXERR) {
        	/* There was no word (empty line). */
        	s = ztrdup("");
        	we = wb = cs;
      ***************
      *** 2930,2942 ****
        	noaliases = 1;
        	do {
        	    ctxtlex();
      ! 	    if (tok == ENDINPUT)
        		break;
        	    if (!first && tokstr && *tokstr)
        		addlinknode(foo, ztrdup(tokstr));
        	    first = 0;
      ! 	}
      ! 	while (tok != ENDINPUT);
        	noaliases = 0;
        	strinend();
        	inpop();
      --- 2929,2940 ----
        	noaliases = 1;
        	do {
        	    ctxtlex();
      ! 	    if (tok == ENDINPUT || tok == LEXERR)
        		break;
        	    if (!first && tokstr && *tokstr)
        		addlinknode(foo, ztrdup(tokstr));
        	    first = 0;
      ! 	} while (tok != ENDINPUT && tok != LEXERR);
        	noaliases = 0;
        	strinend();
        	inpop();
      ***************
      *** 3795,3802 ****
            noerrs = 1;
            do {
        	ctxtlex();
      !     }
      !     while (tok != ENDINPUT && zleparse);
            noerrs = ne;
            noaliases = 0;
            popheap();
      --- 3793,3799 ----
            noerrs = 1;
            do {
        	ctxtlex();
      !     } while (tok != ENDINPUT && tok != LEXERR && zleparse);
            noerrs = ne;
            noaliases = 0;
            popheap();
      ***************
      *** 3869,3875 ****
            do {
        	curlincmd = incmdpos;
        	ctxtlex();
      ! 	if (tok == ENDINPUT)
        	    break;
        	if (tok == STRING && curlincmd) {
        	    zsfree(s);
      --- 3866,3872 ----
            do {
        	curlincmd = incmdpos;
        	ctxtlex();
      ! 	if (tok == ENDINPUT || tok == LEXERR)
        	    break;
        	if (tok == STRING && curlincmd) {
        	    zsfree(s);
      ***************
      *** 3877,3884 ****
        	    cmdwb = ll - wordbeg;
        	    cmdwe = ll + 1 - inbufct;
        	}
      !     }
      !     while (tok != ENDINPUT && zleparse);
            popheap();
            strinend();
            inpop();
      --- 3874,3880 ----
        	    cmdwb = ll - wordbeg;
        	    cmdwe = ll + 1 - inbufct;
        	}
      !     } while (tok != ENDINPUT && tok != LEXERR && zleparse);
            popheap();
            strinend();
            inpop();

-----BEGIN PGP SIGNATURE-----
Version: 2.6.i

iQBVAgUBL/nwYWWJ8JfKi+e9AQF6zQH/QMzkmp0DWZU+e+3dnbeBv6duj/nbtogo
S3TKNlTiMulXsF32NZMKsr0ThvXYXa7i8xmOw1OZ1zz4tOGciM6Bxw==
=Bop0
-----END PGP SIGNATURE-----



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