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

Re: 'remove slash' bug



"Bart Schaefer" wrote:
> On Jun 15,  6:35pm, Peter Stephenson wrote:
> } 3 No space added if the cursor was previously not at the end of
> } the line, i.e. you would get /tmp/foo with the cursor immediately
> } after the foo.  In that case, another tab would add a space, although
> } with the /usr/ example you would get completion inside the directory
> } at that point (which you could with an autoremovable space, but less
> } intuitively).  In this case any space added could still be
> }   (i) autoremovable
> }   (ii) not
> 
> I vote for (3i), if it's not hard to accomplish, simply because of being
> able to get completion inside the directory.

That's what I'd implemented, in fact, and decided I liked it that way,
too (for `end of the line', read `end of the word', however).  The
score is currently 2:0, so here's the patch.

This only has an effect when using completeinword and alwaystoend
together; if you complete inside a word and the cursor stays there,
you get a hard space, and if you complete at the end you get a soft
space.  I haven't changed those.  autoremoveslash is not relevant.

*** Src/Zle/zle_tricky.c.suf	Fri May  8 15:37:14 1998
--- Src/Zle/zle_tricky.c	Mon Jun 15 18:19:19 1998
***************
*** 3352,3358 ****
  	    menupos = wb;
  	} else
  	    menupos = cs;
! 	menuwe = (cs == we) || isset(ALWAYSTOEND);
  	menuend = we;
      }
      /* If we are already in a menu-completion or if we have done a *
--- 3352,3359 ----
  	    menupos = wb;
  	} else
  	    menupos = cs;
! 	/* menuwe == 2 means don't add space if no other suffix */
! 	menuwe = (cs == we) ? 1 : isset(ALWAYSTOEND) ? 2 : 0;
  	menuend = we;
      }
      /* If we are already in a menu-completion or if we have done a *
***************
*** 3470,3476 ****
  	    if(menuwe && isset(AUTOPARAMKEYS))
  		suffixlen[','] = suffixlen['}'] = 1;
  	}
!     } else if(!menucmp && !havesuff) {
  	/* If we didn't add a suffix, add a space, unless we are *
  	 * doing menu completion.                                */
  	inststrlen(" ", 1, 1);
--- 3472,3478 ----
  	    if(menuwe && isset(AUTOPARAMKEYS))
  		suffixlen[','] = suffixlen['}'] = 1;
  	}
!     } else if(!menucmp && !havesuff && menuwe != 2) {
  	/* If we didn't add a suffix, add a space, unless we are *
  	 * doing menu completion.                                */
  	inststrlen(" ", 1, 1);

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy



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