mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-07 09:21:18 +02:00
Merge of 23693: _match tried to match the quoted form of file names and any completion that did it's own quoting.
This commit is contained in:
parent
f850793f05
commit
a3bff3e4ed
1 changed files with 24 additions and 2 deletions
|
@ -969,7 +969,8 @@ match_parts(char *l, char *w, int n, int part)
|
||||||
/* Check if the word w is matched by the strings in pfx and sfx (the prefix
|
/* Check if the word w is matched by the strings in pfx and sfx (the prefix
|
||||||
* and the suffix from the line) or the pattern cp. In clp a cline list for
|
* and the suffix from the line) or the pattern cp. In clp a cline list for
|
||||||
* w is returned.
|
* w is returned.
|
||||||
* qu is non-zero if the words has to be quoted before processed any further.
|
* qu is non-zero if the words has to be quoted before processed any
|
||||||
|
* further: the value 2 indicates file quoting.
|
||||||
* bpl and bsl are used to report the positions where the brace-strings in
|
* bpl and bsl are used to report the positions where the brace-strings in
|
||||||
* the prefix and the suffix have to be re-inserted if this match is inserted
|
* the prefix and the suffix have to be re-inserted if this match is inserted
|
||||||
* in the line.
|
* in the line.
|
||||||
|
@ -986,9 +987,30 @@ comp_match(char *pfx, char *sfx, char *w, Patprog cp, Cline *clp, int qu,
|
||||||
if (cp) {
|
if (cp) {
|
||||||
/* We have a globcomplete-like pattern, just use that. */
|
/* We have a globcomplete-like pattern, just use that. */
|
||||||
int wl;
|
int wl;
|
||||||
|
char *teststr;
|
||||||
|
|
||||||
r = w;
|
r = w;
|
||||||
if (!pattry(cp, r))
|
if (!qu) {
|
||||||
|
/*
|
||||||
|
* If we're not quoting the strings, that means they're
|
||||||
|
* already quoted (?) and so when we test them against
|
||||||
|
* a pattern we have to remove the quotes else we will
|
||||||
|
* end up trying to match against the quote characters.
|
||||||
|
*
|
||||||
|
* Almost certainly this fails in some complicated cases
|
||||||
|
* but it should catch the basic ones.
|
||||||
|
*/
|
||||||
|
teststr = dupstring(r);
|
||||||
|
tokenize(teststr);
|
||||||
|
if (parse_subst_string(teststr))
|
||||||
|
teststr = r;
|
||||||
|
else {
|
||||||
|
remnulargs(teststr);
|
||||||
|
untokenize(teststr);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
teststr = r;
|
||||||
|
if (!pattry(cp, teststr))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
r = (qu == 2 ? tildequote(r, 0) : multiquote(r, !qu));
|
r = (qu == 2 ? tildequote(r, 0) : multiquote(r, !qu));
|
||||||
|
|
Loading…
Reference in a new issue