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

Re: Yet another auto-remove-suffix problem in 3.1.5



I wrote:

> Bart Schaefer wrote:
> 
> > 
> > Under 3.1.5, using the cdmatch compctl from Misc/compctl-examples and using
> > Functions/cdmatch, with automenu:
> > 
> > zagzig<6> cd zsh-3.1.5
> > zagzig<7> cd S<TAB><TAB>
> > Src           StartupFiles
> > zagzig<7> cd Src/
> > 
> > Now type another /, and you get
> > 
> > zagzig<7> cd Src//
> > 
> > In zsh 3.0.5, using exactly the same cdmatch function and compctl, exactly
> > the same input triggers autoremove and you get only Src/ (one slash).
> > 
> > If you type a space at 3.1.5 instead, the trailing slash is removed as
> > expected.
> > 
> > This probably means another call to fixsuffix() has to be thrown in, or one
> > already there needs to be moved.  I haven't figured out where yet, and I'm
> > out of zsh time for a while, so if somebody else wants this ...
> > 
> 
> This one troubles me, too. For me it behaves correctly (leaving only
> one slash). Are you sure you have autoremoveslash set? Any other
> completion options?
> 

After a private reply from Bart I had to notice that I missed the very 
first line in his post (the one saying that the cdmatch example is
used).

So the `problem' is that with "compctl ... -q -S '/'" the inserted `/'
doesn't get removed by typing another slash. This is correct with
respect to the manual:

  `-q'
       If used with a suffix as specified by the previous option, this
       causes the suffix to be removed if the next character typed is a
       blank or does not insert anything (the same rule as used for the
       `AUTO_REMOVE_SLASH' option).  The option is most useful for list
       separators (comma, colon, etc.).

On the other side, it might indeed be intersting to have the
completion code automatically remove the inserted suffix, if it is of
length one and the next character typed is the same as the inserted
character. The patch below implements this. Of course this might be
irritating for those who use have used the old behaviour, but I expect 
most people never saw this.


Bye
 Sven

*** Src/Zle/zle_tricky.c.old	Tue Nov  3 08:51:28 1998
--- Src/Zle/zle_tricky.c	Tue Nov  3 08:52:01 1998
***************
*** 3377,3384 ****
  	    havesuff = 1;
  	    inststr(ccsuffix);
  	    menuinsc = ztrlen(ccsuffix);
! 	    if (remsuffix && menuwe)
  		makesuffix(menuinsc);
  	}
  	havesuff = 1;
      } else {
--- 3377,3387 ----
  	    havesuff = 1;
  	    inststr(ccsuffix);
  	    menuinsc = ztrlen(ccsuffix);
! 	    if (remsuffix && menuwe) {
  		makesuffix(menuinsc);
+ 		if (menuinsc == 1)
+ 		    suffixlen[*ccsuffix] = 1;
+ 	    }
  	}
  	havesuff = 1;
      } else {
*** Doc/Zsh/compctl.yo.old	Tue Nov  3 08:56:52 1998
--- Doc/Zsh/compctl.yo	Tue Nov  3 08:58:34 1998
***************
*** 326,333 ****
  item(tt(-q))(
  If used with a suffix as specified by the tt(-S) option, this
  causes the suffix to be removed if the next character typed is a blank
! or does not insert anything (the same rule as used for the
! tt(AUTO_REMOVE_SLASH) option).  The option is most useful for list
  separators (comma, colon, etc.).
  )
  item(tt(-l) var(cmd))(
--- 326,334 ----
  item(tt(-q))(
  If used with a suffix as specified by the tt(-S) option, this
  causes the suffix to be removed if the next character typed is a blank
! or does not insert anything or if the suffix consists of only one character
! and the next character typed is the same character (the same rule as used
! for the tt(AUTO_REMOVE_SLASH) option).  The option is most useful for list
  separators (comma, colon, etc.).
  )
  item(tt(-l) var(cmd))(


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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