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

Re: compset -P '/'



Tanaka Akira wrote:

> I found a problem with completion.
> 
> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% rm -rf z
> is27e1u11% mkdir z z/y
> is27e1u11% touch z/a
> is27e1u11% _tst () {
> function> compset -P '/'
> function> _path_files -g '*(^/)'
> function> _path_files -g '*(/)'
> function> }
> is27e1u11% tst /z/<TAB>
> 
> ->
> 
> is27e1u11% tst /
> 
> zsh removes `z/' and the cursor is places on retained `/'.
> But it should complete the file `a' and the directory `y'.

It got confused about the match specs to use... the test the patch
removes only made sense in the compctl code.

> If the prefix is a colon rather than a slash, it works well.
> 
> is27e1u11% _tst () {
> compset -P ':'
> _path_files -g '*(^/)'
> _path_files -g '*(/)'
> }
> is27e1u11% tst :z/<TAB>
> a   y/

Because it didn't have a match spec comparable to `r:|/=*'.

Bye
 Sven

diff -ru ../z.old/Src/Zle/compcore.c Src/Zle/compcore.c
--- ../z.old/Src/Zle/compcore.c	Mon Jan 24 10:55:00 2000
+++ Src/Zle/compcore.c	Mon Jan 24 11:32:21 2000
@@ -1603,8 +1603,7 @@
 		mst.matcher = dat->match;
 		mstack = &mst;
 
-		if (!mnum)
-		    add_bmatchers(dat->match);
+		add_bmatchers(dat->match);
 
 		addlinknode(matchers, dat->match);
 		dat->match->refc++;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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