zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: A couple of bugs
Date: Wed, 3 Mar 1999 11:52:38 +0100 (MET)	[thread overview]
Message-ID: <199903031052.LAA21140@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Kiddle, Oliver"'s message of Tue, 2 Mar 1999 17:11:11 -0000


(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


             reply	other threads:[~1999-03-03 10:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-03 10:52 Sven Wischnowsky [this message]
2000-04-03  9:51 Oliver Kiddle
2000-04-03 10:11 ` Bart Schaefer
2000-04-03 11:31 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199903031052.LAA21140@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).