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

Re: completion with prefix which contains meta character.



Tanaka Akira wrote:

> I tried to complete with prefix `*' but zsh doesn't work well.
> 
> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% _tst () { compadd -P '*' xxx }
> is27e1u11% tst \*<TAB>
> 
> This doesn't complete anything.
> 
> is27e1u11% _tst () { compadd -P '\*' xxx } 
> is27e1u11% tst \*<TAB>
> 
> This doesn't complete anything too.

But it should. At least I wanted to get the -P and -S be used
literally (should be the most powerful, right?).

Since I feel adventurous today, I even documented that.

And that rembslash() didn't make any sense at all.

Bye
 Sven

diff -ru ../z.old/Doc/Zsh/compwid.yo Doc/Zsh/compwid.yo
--- ../z.old/Doc/Zsh/compwid.yo	Thu Jan  6 10:27:21 2000
+++ Doc/Zsh/compwid.yo	Thu Jan  6 10:37:22 2000
@@ -420,7 +420,8 @@
 startitem()
 item(tt(-P) var(prefix))(
 This gives a string to be inserted before the given var(words).  The
-string given is not considered as part of the match.
+string given is not considered as part of the match and any shell
+metacharacters in it will not be quoted when the string is inserted.
 )
 item(tt(-S) var(suffix))(
 Like tt(-P) but gives a string to be inserted after the match.
diff -ru ../z.old/Src/Zle/compcore.c Src/Zle/compcore.c
--- ../z.old/Src/Zle/compcore.c	Thu Jan  6 10:27:14 2000
+++ Src/Zle/compcore.c	Thu Jan  6 10:32:46 2000
@@ -1629,9 +1629,7 @@
 		llsl = strlen(lsuf);
 		/* Test if there is an existing -P prefix. */
 		if (dat->pre && *dat->pre) {
-		    char *dp = rembslash(dat->pre);
-
-		    pl = pfxlen(dp, lpre);
+		    pl = pfxlen(dat->pre, lpre);
 		    llpl -= pl;
 		    lpre += pl;
 		}

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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