Turn on -o filenames in _tilde() only when it produces completions.

This commit is contained in:
Ville Skyttä 2011-04-24 20:09:02 +03:00
parent 0042c06204
commit e104424ff2

View File

@ -852,10 +852,10 @@ _tilde()
{
local result=0
if [[ $1 == ~* && $1 != */* ]]; then
compopt -o filenames 2>/dev/null
# Try generate ~username completions
COMPREPLY=( $( compgen -P '~' -u "${1#\~}" ) )
result=${#COMPREPLY[@]}
[ $result -gt 0 ] && compopt -o filenames 2>/dev/null
fi
return $result
}