diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2007-07-23 13:24:44 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2007-07-23 13:24:44 +0000 |
commit | 4860917a49abfbfedf976d924dd7dc0f1f5d8e03 (patch) | |
tree | 03368887169234e05428feb1bf59425ca30a230c | |
parent | c388a9f495a6ffceb5a3ed6e9f6ddf2b4b5ef180 (diff) | |
download | zsh-4860917a49abfbfedf976d924dd7dc0f1f5d8e03.tar.gz zsh-4860917a49abfbfedf976d924dd7dc0f1f5d8e03.tar.xz zsh-4860917a49abfbfedf976d924dd7dc0f1f5d8e03.zip |
23693: _match completion tried to match the quoted form of filenames
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/Zle/compmatch.c | 26 |
2 files changed, 29 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 1f6a2c705..852d35036 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-07-23 Peter Stephenson <pws@csr.com> + + * 23693: Src/Zle/compmatch.c: _match tried to match the quoted + form of file names and any completion that did it's own quoting. + 2007-07-22 Clint Adams <clint@zsh.org> * 23691: Completion/BSD/Command/_portsnap: declare local parameter diff --git a/Src/Zle/compmatch.c b/Src/Zle/compmatch.c index 41448c13e..b08dcd2bc 100644 --- a/Src/Zle/compmatch.c +++ b/Src/Zle/compmatch.c @@ -966,7 +966,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 * and the suffix from the line) or the pattern cp. In clp a cline list for * 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 * the prefix and the suffix have to be re-inserted if this match is inserted * in the line. @@ -983,9 +984,30 @@ comp_match(char *pfx, char *sfx, char *w, Patprog cp, Cline *clp, int qu, if (cp) { /* We have a globcomplete-like pattern, just use that. */ int wl; + char *teststr; 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; r = (qu == 2 ? tildequote(r, 0) : multiquote(r, !qu)); |