zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: _expand doesn't do brace expansion?
Date: Fri, 16 Jun 2000 09:50:27 +0200 (MET DST)	[thread overview]
Message-ID: <200006160750.JAA12736@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Thu, 15 Jun 2000 10:22:22 +0000


Bart Schaefer wrote:

> On Jun 15, 11:20am, Sven Wischnowsky wrote:
> } Subject: Re: _expand doesn't do brace expansion?
> }
> } Oh, didn't everyone know that?
> 
> _complete manages to complete inside braces; why does the code that
> understands braces stop taking them apart when there's a closed pair?
> AFAICT, no completion works at all once any close brace is in place,
> even if that's within an outer set of braces, e.g.
> 
> zagzig[52] ls Functions/({Mi<TAB>
> zagzig[52] ls Functions/{{Misc/<,TAB>
> zagzig[52] ls Functions/{{Misc,
> Completing file
> README.zftp   Zftp/         Prompts/      CVS/                      
> Makefile.in   Zle/          Misc/                                 
> zagzig[52] ls Functions/{{Misc,P<TAB>
> zagzig[52] ls Functions/{{Misc,Prompts/<},TAB>
> zagzig[52] ls Functions/{{Misc,Prompts},
> Completing `file' or `corrections'
> (BEEP)

Here's the patch to make this work. But only the `a{{b,c},<TAB>'
thing, not `a{b,c}<TAB>'. This is mostly a matter of removing two
tests. The other hunks are the result of me hunting down a bug with
re-inserting closed braces in a cline with CLF_MID (that's the cline
for the middle when completing from both ends). This took me quite
some time, so this is the last of my patches from yesterday (although
I still have one from the last weekend, maybe later...).

About the `a{b,c}<TAB>': of course this discussion now got me thinking 
about it again, but this is horrible. There are a few things that I
never changed in all my work on the completion code from 2.4.xxx
on. One of them is that the completion code only ever has to work on
one string. Trying to implement the above would change that and
currently I don't even know where to place the loop over the possible
prefixes/suffixes. But since the weekend is before us and I don't have 
anything else to do (well, not much), maybe I'll play. I doubt that
this will result in a patch, but maybe I'll know more about this on
monday. (At least I agree that it would be cool to have that. Does any 
other shell complete in or after braces at all?)

Bye
 Sven

Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.20
diff -u -r1.20 compmatch.c
--- Src/Zle/compmatch.c	2000/06/15 09:41:48	1.20
+++ Src/Zle/compmatch.c	2000/06/16 07:49:16
@@ -1608,6 +1608,7 @@
 
 		continue;
 	    }
+	    o->llen = o->llen - ot->slen;
 	    join = 1; line = 0; slen = &(o->wlen); sstr = &(o->word);
 	}
 	if (join) {
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.19
diff -u -r1.19 compresult.c
--- Src/Zle/compresult.c	2000/06/05 07:57:27	1.19
+++ Src/Zle/compresult.c	2000/06/16 07:49:16
@@ -406,8 +406,8 @@
      * with missing characters, we take this, otherwise if we have a
      * prefix with missing characters, we take that, the same for a
      * suffix, and finally a place where the matches differ. */
-    ncs = (cbr >= 0 ? cbr :
-	   (mid >= 0 ? mid :
+    ncs = (mid >= 0 ? mid :
+	   (cbr >= 0 ? cbr :
 	    (pm >= 0 ? pm : (sm >= 0 ? sm : (d >= 0 ? d : cs)))));
 
     if (!ins) {
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.14
diff -u -r1.14 zle_tricky.c
--- Src/Zle/zle_tricky.c	2000/06/08 07:20:31	1.14
+++ Src/Zle/zle_tricky.c	2000/06/16 07:49:16
@@ -1434,10 +1434,6 @@
 		    }
 		}
 	    } else if (p < curs) {
-		if (*p == Outbrace) {
-		    cant = 1;
-		    break;
-		}
 		if (*p == Inbrace) {
 		    if (bbeg) {
 			Brinfo new;
@@ -1474,10 +1470,6 @@
 		    hascom = 1;
 		}
 	    } else {
-		if (*p == Inbrace) {
-		    cant = 1;
-		    break;
-		}
 		if (p == curs) {
 		    if (bbeg) {
 			Brinfo new;

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


             reply	other threads:[~2000-06-16  7:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-16  7:50 Sven Wischnowsky [this message]
2000-06-16 17:37 ` Bart Schaefer

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=200006160750.JAA12736@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).