Move _filedir fix to _quote_readline_by_ref.
This commit is contained in:
parent
3d4941fa96
commit
50824f909d
@ -542,6 +542,11 @@ _quote_readline_by_ref()
|
|||||||
else
|
else
|
||||||
printf -v $2 %q "$1"
|
printf -v $2 %q "$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# If result becomes quoted like this: $'string', re-evaluate in order to
|
||||||
|
# drop the additional quoting. See also: http://www.mail-archive.com/
|
||||||
|
# bash-completion-devel@lists.alioth.debian.org/msg01942.html
|
||||||
|
[[ ${!2:0:1} == '$' ]] && eval $2=${!2}
|
||||||
} # _quote_readline_by_ref()
|
} # _quote_readline_by_ref()
|
||||||
|
|
||||||
|
|
||||||
@ -570,15 +575,6 @@ _filedir()
|
|||||||
# bash-3.1. See also:
|
# bash-3.1. See also:
|
||||||
# http://www.mail-archive.com/bug-bash@gnu.org/msg01667.html
|
# http://www.mail-archive.com/bug-bash@gnu.org/msg01667.html
|
||||||
_quote_readline_by_ref "$cur" quoted
|
_quote_readline_by_ref "$cur" quoted
|
||||||
if [[ ${quoted:0:1} == '$' ]]; then
|
|
||||||
toks=( ${toks[@]-} $(
|
|
||||||
eval compgen -d -- "$quoted" | {
|
|
||||||
while read -r tmp; do
|
|
||||||
printf '%s\n' $tmp
|
|
||||||
done
|
|
||||||
}
|
|
||||||
))
|
|
||||||
else
|
|
||||||
toks=( ${toks[@]-} $(
|
toks=( ${toks[@]-} $(
|
||||||
compgen -d -- "$quoted" | {
|
compgen -d -- "$quoted" | {
|
||||||
while read -r tmp; do
|
while read -r tmp; do
|
||||||
@ -586,7 +582,6 @@ _filedir()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
))
|
))
|
||||||
fi
|
|
||||||
|
|
||||||
# On bash-3, special characters need to be escaped extra. This is
|
# On bash-3, special characters need to be escaped extra. This is
|
||||||
# unless the first character is a single quote ('). If the single
|
# unless the first character is a single quote ('). If the single
|
||||||
@ -600,10 +595,7 @@ _filedir()
|
|||||||
#
|
#
|
||||||
if [[ "$1" != -d ]]; then
|
if [[ "$1" != -d ]]; then
|
||||||
xspec=${1:+"!*.$1"}
|
xspec=${1:+"!*.$1"}
|
||||||
# in some situation, _quote_readline_by_ref actually overquote,
|
if [[ ${cur:0:1} == "'" && ${BASH_VERSINFO[0]} -ge 4 ]]; then
|
||||||
# hence the need to eval the result
|
|
||||||
if [[ ${cur:0:1} == "'" && ${BASH_VERSINFO[0]} -ge 4 ]] || \
|
|
||||||
[[ ${quoted:0:1} == '$' ]]; then
|
|
||||||
toks=( ${toks[@]-} $(
|
toks=( ${toks[@]-} $(
|
||||||
eval compgen -f -X \"\$xspec\" -- $quoted
|
eval compgen -f -X \"\$xspec\" -- $quoted
|
||||||
) )
|
) )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user