Fix regressions and further tweak previous java completion patch.

Fix inner class regression, adapt test suite, turn off nospace for
single class completions, protect -o nospace for bash < 4.
This commit is contained in:
Ville Skyttä 2011-03-24 20:45:16 +02:00
parent 920b1f93b6
commit a73774c833
2 changed files with 7 additions and 4 deletions

View File

@ -72,11 +72,14 @@ _java_classes()
fi
elif [ -d $i ]; then
compopt -o nospace
compopt -o nospace &>/dev/null
COMPREPLY=( "${COMPREPLY[@]}"
$( compgen -d -- $i/$cur | sed -e "s|^$i/\(.*\)|\1.|" )
$( compgen -f -X '!*.class' -- $i/$cur | sed -e "s|^$i/||" )
$( compgen -d -- "$i/$cur" | sed -e "s|^$i/\(.*\)|\1.|" )
$( compgen -f -X '!*.class' -- "$i/$cur" | \
sed -e '/\$/d' -e "s|^$i/||" )
)
[[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == *.class ]] && \
compopt +o nospace &>/dev/null
# FIXME: if we have foo.class and foo/, the completion
# returns "foo/"... how to give precedence to files

View File

@ -18,7 +18,7 @@ assert_complete_any "java -"
sync_after_int
assert_complete "b bashcomp.jarred toplevel" "java "
assert_complete "b bashcomp.jarred c. toplevel" "java "
sync_after_int