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

Re: A couple of bugs



(Having had trouble sending this to the list, Oliver sent me this
directly...)

Kiddle, Oliver wrote:

> Completion in braces doesn't work properly with directories:
> 
> zsh -f
> ls /usr/local/{bin<tab><tab>
> 
> Results in:
> ls /usr/local/{{bin/
> The first tab adds the slash. The second, which I would expect to list
> files in /usr/local/bin inserts a second brace. I also get strange
> results from
> ls /usr/local/{bin/,<tab>
> 
> I noticed the following effect of completion matching in pws-10 which
> looks like a bug to me:

Fixed by the patch below.

> zsh -f
> setopt EXTENDED_GLOB GLOB_COMPLETE
> cd~opk<tab>
> 
> That results in a beep, as I would expect. Now if I continue:
> 
> compctl -M 'm:{a-z}={A-Z}'
> cd~opk<tab>
> 
> I now get
> cd _
> where the underscore is the cursor.

Here I think, the second behaviour is the correct one, because `cd~opk'
is (with extendedglob) a valid pattern, meaning: match `cd' unless it
also matches `opk'. Since `cd' only seldom looks like `opk' this is
the same as saying `cd'. Right?
So the first case should be changed to behave the same as the second
one.

Btw. I'd like to express my thankfulness to all of you who send me bug 
reports for the completion code (or sugegstions for the new stuff,
or...), it's so complicated that I just can't test everything.
Thanks. And sorry that there are so many bugs.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Wed Mar  3 09:03:29 1999
+++ Src/Zle/zle_tricky.c	Wed Mar  3 11:42:55 1999
@@ -4489,7 +4489,7 @@
 		 (((addwhat & CC_DISCMDS) && (hn->flags & DISABLED)) ||
 		  ((addwhat & CC_EXCMDS)  && !(hn->flags & DISABLED)))) ||
 		((addwhat & CC_BINDINGS) && !(hn->flags & DISABLED))))) {
-	if (sl >= rpl + rsl || mstack) {
+	if (sl >= rpl + rsl || mstack || cp) {
 	    if (cp) {
 		test = domatch(s, patcomp, 0);
 		e = s + sl;
@@ -6145,6 +6145,8 @@
 	    line[cs] = 0;
 	    lppre = dupstring((char *) (line + wb));
 	    line[cs] = save;
+	    if (brbeg && *brbeg)
+		strcpy(lppre + brpl, lppre + brpl + strlen(brbeg));
 	    if ((p = strrchr(lppre, '/'))) {
 		p[1] = '\0';
 		lppl = strlen(lppre);
@@ -6161,8 +6163,14 @@
 	    char save = line[we];
 
 	    line[we] = 0;
-	    lpsuf = strchr(dupstring((char *) (line + cs)), '/');
+	    lpsuf = dupstring((char *) (line + cs));
 	    line[we] = save;
+	    if (brend && *brend) {
+		char *p = lpsuf + brsl - (cs - wb);
+
+		strcpy(p, p + strlen(brend));
+	    }
+	    lpsuf = strchr(lpsuf, '/');
 	    lpsl = (lpsuf ? strlen(lpsuf) : 0);
 	}
 	else {

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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