From a73774c8330e7fc1d4b917d31a87897804a47265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 24 Mar 2011 20:45:16 +0200 Subject: [PATCH] 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. --- completions/java | 9 ++++++--- test/lib/completions/java.exp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/completions/java b/completions/java index 4e0ae9ca..73a88907 100644 --- a/completions/java +++ b/completions/java @@ -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 diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp index 842501d2..e41dbccc 100644 --- a/test/lib/completions/java.exp +++ b/test/lib/completions/java.exp @@ -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