From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1501 invoked from network); 17 Aug 2001 09:16:50 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 Aug 2001 09:16:50 -0000 Received: (qmail 8046 invoked by alias); 17 Aug 2001 09:16:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15650 Received: (qmail 8035 invoked from network); 17 Aug 2001 09:16:43 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15228.57578.582005.656806@gargle.gargle.HOWL> Date: Fri, 17 Aug 2001 11:16:26 +0200 To: zsh-workers@sunsite.dk Subject: Re: Bug in _approximate with ~/ In-Reply-To: <1010816174501.ZM12190@candle.brasslantern.com> References: <1010816174501.ZM12190@candle.brasslantern.com> X-Mailer: VM 6.92 under 21.1 (patch 3) "Acadia" XEmacs Lucid Bart Schaefer wrote: > ... > > This results in a PREFIX that looks like `(#a1)~/test/f'. _path_files > does the right thing with this -- it peels off the (#a1), expands the > tilde, and then applies (#a1) to each path element. However, none of > the other completions that are attempted in command position are this > intelligent -- they all interpret `(#a1)~/test/f' as `(#a1)()~/test/f', > that is, allow one correction to the empty string as long as that does > not match `/test/f'. Consequently you get all the one-letter commands, > parameters, reserved words, etc. > > You're right, this is a bug. Hmhm. To be fixed in C-code where the globbing flags are moved farther into the prefix if needed. This also made me notice a slightly wrong test in _path_files. Bye Sven Index: Completion/Unix/Type/_path_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v retrieving revision 1.10 diff -u -r1.10 _path_files --- Completion/Unix/Type/_path_files 2001/08/13 10:57:44 1.10 +++ Completion/Unix/Type/_path_files 2001/08/17 09:13:31 @@ -653,7 +653,7 @@ if zstyle -t ":completion:${curcontext}:paths" expand prefix && [[ nm -eq compstate[nmatches] && $#exppaths -ne 0 && - "$exppaths" != "$eorig" ]]; then + "$linepath$exppaths" != "$eorig" ]]; then PREFIX="${opre}" SUFFIX="${osuf}" compadd -Q "$mopts[@]" -S '' -M "r:|/=* r:|=*" -p "$linepath" -a exppaths Index: Src/Zle/compcore.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v retrieving revision 1.48 diff -u -r1.48 compcore.c --- Src/Zle/compcore.c 2001/07/25 10:45:59 1.48 +++ Src/Zle/compcore.c 2001/08/17 09:13:32 @@ -1782,21 +1782,23 @@ } else lsl = 0; if (dat->aflags & CAF_MATCH) { - int ml, gfl = 0; + int ml, gfl = 0, tildepat = 0; char *globflag = NULL; if (comppatmatch && *comppatmatch && - dat->ppre && lpre[0] == '(' && lpre[1] == '#') { + lpre[0] == '(' && lpre[1] == '#') { char *p; for (p = lpre + 2; *p && *p != ')'; p++); - if (*p == ')') { + if (*p == ')' && (dat->ppre || p[1] == '~')) { char sav = p[1]; p[1] = '\0'; globflag = dupstring(lpre); gfl = p - lpre + 1; + if (!dat->ppre) + tildepat = 1; p[1] = sav; lpre = p + 1; @@ -1859,7 +1861,11 @@ int is = (*comppatmatch == '*'); char *tmp = (char *) zhalloc(2 + llpl + llsl + gfl); - if (gfl) { + if (tildepat) { + tmp[0] = '~'; + strcpy(tmp + 1, globflag); + strcat(tmp, lpre + 1); + } else if (gfl) { strcpy(tmp, globflag); strcat(tmp, lpre); } else -- Sven Wischnowsky wischnow@informatik.hu-berlin.de