zsh-workers
 help / color / mirror / code / Atom feed
* Re: A couple of bugs
@ 1999-03-03 10:52 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-03-03 10:52 UTC (permalink / raw)
  To: zsh-workers


(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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A couple of bugs
@ 2000-04-03 11:31 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-04-03 11:31 UTC (permalink / raw)
  To: zsh-workers


Oliver Kiddle wrote:

> ...
> 
> The second bug is that completion after ~+ or ~- seems to have been
> broken since dev-19:
>   cd ~+1/<tab>
>   unknown user `+1'
> Here I would expect file completion after the appropriate directory
> from the stack. The problem is also the case for named directories.

_path_files just wasn't able to handle the directory stack entries.

Bye
 Sven

Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.3
diff -u -r1.3 _path_files
--- Completion/Core/_path_files	2000/04/03 11:05:16	1.3
+++ Completion/Core/_path_files	2000/04/03 11:30:21
@@ -170,6 +170,23 @@
     realpath="${userdirs[$linepath]%/}/"
   elif (( $+nameddirs[$linepath] )); then
     realpath="${nameddirs[$linepath]%/}/"
+  elif [[ "$linepath" = [-+][0-9]## ]]; then
+    if [[ "$linepath" = -* ]]; then
+      tmp=$(( $#dirstack $linepath ))
+    else
+      tmp=$linepath[2,-1]
+    fi
+    [[ -o pushdminus ]] && tmp=$(( $#dirstack - $tmp ))
+    if (( ! tmp )); then
+      realpath=$PWD/
+    elif [[ tmp -le $#dirstack ]]; then
+      realpath=$dirstack[tmp]/
+    else
+      _message 'not directory stack entries'
+      return 1
+    fi
+  elif [[ "$linepath" = [-+] ]]; then
+    realpath=${~:-\~$linepath}/
   else
     _message "unknown user \`$linepath'"
     return 1

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A couple of bugs
  2000-04-03  9:51 Oliver Kiddle
@ 2000-04-03 10:11 ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2000-04-03 10:11 UTC (permalink / raw)
  To: Zsh workers

On Apr 3, 10:51am, Oliver Kiddle wrote:
} Subject: A couple of bugs
}
} I [...] found what I think is a bug with the handling of
} patterns of the form pat1~pat2. This bug manifests itself when the
} first character of pat2 is a slash. Try this:
}   echo /*~/dev
} This gives me a message about no matches found.

This works for me ... I think it was fixed by 10284,10320.

} The second bug is that completion after ~+ or ~- seems to have been
} broken since dev-19:
}   cd ~+1/<tab>
}   unknown user `+1'

I just get a beep here (no "unknown user" messag), and in fact completion
after ~+ and ~- has not worked for me for longer than since -dev-19.  I
can't remember it ever working, but then it's another thing I don't use
very often.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* A couple of bugs
@ 2000-04-03  9:51 Oliver Kiddle
  2000-04-03 10:11 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2000-04-03  9:51 UTC (permalink / raw)
  To: Zsh workers

I was trying to work out why completion for the second argument to cd
wasn't working and found what I think is a bug with the handling of
patterns of the form pat1~pat2. This bug manifests itself when the
first character of pat2 is a slash. Try this:
  echo /*~/dev
This gives me a message about no matches found. I would expect results
similar to what you see with:
  echo /*~[/]dev

The second bug is that completion after ~+ or ~- seems to have been
broken since dev-19:
  cd ~+1/<tab>
  unknown user `+1'
Here I would expect file completion after the appropriate directory
from the stack. The problem is also the case for named directories.

Oliver Kiddle


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-04-03 11:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-03 10:52 A couple of bugs Sven Wischnowsky
2000-04-03  9:51 Oliver Kiddle
2000-04-03 10:11 ` Bart Schaefer
2000-04-03 11:31 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).