Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: tilde quoting.
- X-seq: zsh-workers 6975
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: tilde quoting.
- Date: Mon, 5 Jul 1999 13:46:38 +0200 (MET DST)
- In-reply-to: Tanaka Akira's message of 04 Jul 1999 10:38:53 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Tanaka Akira wrote:
> % zsh -f
> is27e1u11% echo $ZSH_VERSION
> 3.1.5-pws-25
> is27e1u11% autoload -U compinit; compinit -D
> is27e1u11% mkdir -p ~/tst/a.b
> is27e1u11% touch ~/tst/a.b/c
> is27e1u11% ls ~/tst/a/<TAB>
>
> Then, the command line is expanded as follows.
>
> is27e1u11% ls \~/tst/a.b/c
>
> Hm. The tilde is quoted.
> I think it's a bug.
Yes. Hm, in some places we already have special cased quoting of a
tilde at the beginning of a string. We probably should do this for
completions which are said to be file names, too.
Bye
Sven
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c Mon Jul 5 10:24:34 1999
+++ Src/Zle/zle_tricky.c Mon Jul 5 13:43:47 1999
@@ -2577,7 +2577,8 @@
return NULL;
r = (qu ? quotename(r, NULL) : dupstring(r));
-
+ if (qu == 2 && r[0] == '\\' && r[1] == '~')
+ chuck(r);
/* We still break it into parts here, trying to build a sensible
* cline list for these matches, too. */
wl = strlen(w);
@@ -2590,6 +2591,8 @@
int mpl, rpl, wl;
w = (qu ? quotename(w, NULL) : dupstring(w));
+ if (qu == 2 && w[0] == '\\' && w[1] == '~')
+ chuck(w);
wl = strlen(w);
@@ -3814,15 +3817,20 @@
dat->rems = dupstring(dat->rems);
/* Probably quote the prefix and suffix for testing. */
- if (!cp && (dat->aflags & CAF_MATCH) &&
- !(dat->aflags & CAF_QUOTE)) {
- lpre = quotename(lpre, NULL);
- lsuf = quotename(lsuf, NULL);
- }
- if (dat->ppre)
- dat->ppre = quotename(dat->ppre, NULL);
- if (dat->psuf)
- dat->psuf = quotename(dat->psuf, NULL);
+ if (!(dat->aflags & CAF_QUOTE)) {
+ if (!cp && (dat->aflags & CAF_MATCH)) {
+ lpre = quotename(lpre, NULL);
+ lsuf = quotename(lsuf, NULL);
+ }
+ if (dat->ppre) {
+ dat->ppre = quotename(dat->ppre, NULL);
+ if ((dat->flags & CMF_FILE) &&
+ dat->ppre[0] == '\\' && dat->ppre[1] == '~')
+ chuck(dat->ppre);
+ }
+ if (dat->psuf)
+ dat->psuf = quotename(dat->psuf, NULL);
+ }
}
/* Walk through the matches given. */
for (; (s = *argv); argv++) {
@@ -3855,7 +3863,9 @@
lc = bld_parts(ms, sl, -1, NULL);
isexact = 0;
} else if (!(ms = comp_match(lpre, lsuf, s, cp, &lc,
- !(dat->aflags & CAF_QUOTE),
+ (!(dat->aflags & CAF_QUOTE) ?
+ ((dat->ppre && dat->ppre) ||
+ !(dat->flags & CMF_FILE) ? 1 : 2) : 0),
&bpl, &bsl, &isexact))) {
if (dparr && !*++dparr)
dparr = NULL;
@@ -3962,7 +3972,7 @@
}
ms = ((addwhat == CC_FILES || addwhat == -6 ||
addwhat == -5 || addwhat == -8) ?
- comp_match(qfpre, qfsuf, s, filecomp, &lc, 1,
+ comp_match(qfpre, qfsuf, s, filecomp, &lc, (ppre && *ppre ? 1 : 2),
&bpl, &bsl, &isexact) :
comp_match(fpre, fsuf, s, filecomp, &lc, 0,
&bpl, &bsl, &isexact));
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author