1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-01 18:30:55 +01:00

43752: Fix _expand quoting.

Quoting was not applied properly if globbing failed or was not applied.
This commit is contained in:
Peter Stephenson 2018-11-03 19:36:06 +00:00
parent 58bfa1665b
commit 916ba78cd7
2 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2018-11-03 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 43752: Completion/Base/Completer/_expand: Fix quoting if
globbing failed / was not tried for expression on command line.
2018-11-02 Oliver Kiddle <okiddle@yahoo.co.uk>
* 43748: Completion/Unix/Command/_ack: fix for ack 3beta

View file

@ -103,9 +103,19 @@ subd=("$exp[@]")
# Now try globbing.
[[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob &&
eval 'exp=( ${~exp//(#b)\\([ \"'"\'"'
# We need to come out of this with consistent quoting, by hook or by crook.
integer done_quote
local orig_exp=$exp
if [[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob; then
eval 'exp=( ${~exp//(#b)\\([ \"'"\'"'
])/$match[1]} ); exp=( ${(q)exp} )' 2>/dev/null && done_quote=1
fi
# If the globbing failed, or we didn't try globbing, we'll do
# it again without the "~" so globbing is simply omitted.
if (( ! done_quote )); then
eval 'exp=( ${orig_exp//(#b)\\([ \"'"\'"'
])/$match[1]} ); exp=( ${(q)exp} )' 2>/dev/null
fi
### Don't remember why we once used this instead of the (q) above.
# eval 'exp=( ${~exp} ); exp=( ${exp//(#b)([][()|*?^#~<>\\=])/\\${match[1]}} )' 2>/dev/null