From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2787 invoked from network); 16 Jun 2000 07:50:44 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 Jun 2000 07:50:44 -0000 Received: (qmail 14605 invoked by alias); 16 Jun 2000 07:50:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11939 Received: (qmail 14596 invoked from network); 16 Jun 2000 07:50:30 -0000 Date: Fri, 16 Jun 2000 09:50:27 +0200 (MET DST) Message-Id: <200006160750.JAA12736@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Thu, 15 Jun 2000 10:22:22 +0000 Subject: PATCH: Re: _expand doesn't do brace expansion? 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 > 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 > 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},' thing, not `a{b,c}'. 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}': 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