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

Re: Completion behavior change in 3.0-pre3



On Jul 15, 11:00pm, Bart Schaefer wrote:
> Subject: Completion behavior change in 3.0-pre3
> Here's zsh 3.0-pre2:
> 
> zagzig[85] echo z*i<TAB>
> (feep)
> zagzig[85] echo z*i
> 
> Here's zsh 3.0-pre3:
> 
> zagzig<3> echo z*i<TAB>
> (feep)
> zagzig<3> echo z\*i

I've traced the point where the extra backslash gets inserted into
makecomplist(), right here:

    /* ... */
    lpre = zalloc(lpl + 1);
    memcpy(lpre, s, lpl);
    lpre[lpl] = '\0';
    p = quotename(lpre, NULL, NULL, NULL);
    if (strcmp(p, lpre) && !strpfx(p, qword)) {
	/* ... */
	inststrlen(p, 1, l2 = strlen(p));	/* This adds the backslash */
	/* ... */
    }
    /* ... */

In 3.0-pre2 and earlier, the backslash would get removed again as shown
by the following patch (which backs out two hunks of Zoltan's changes).
I'm not sure why Zoltan thought the line should only be restored when
going around the xorrec: loop.  Should cs et.al. get restored along with
the line when *not* going around the loop?  (They weren't in pre2, this
just puts back the pre2 behavior.)

*** Src/zle_tricky.c.0	Mon Jul 15 22:46:49 1996
--- Src/zle_tricky.c	Wed Jul 17 14:45:34 1996
***************
*** 2957,2962 ****
--- 2957,2964 ----
      validlist = 1;
      if(nmatches && !errflag)
  	return 0;
+     /* No matches: restore the command line. */
+     strcpy((char *)line, (char *)ol);
  
      if ((isf || cc->xor) && !parampre) {
  	/* We found no matches, but there is a xor'ed completion: *
***************
*** 2967,2973 ****
  	wb = owb;
  	we = owe;
  	cs = ocs;
- 	strcpy((char *)line, (char *)ol);
  	offs = oloffs;
  	s = dupstring(os);
  	free(amatches);
--- 2969,2974 ----




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