[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-42-ga73774c

Ville Skyttä ville.skytta at iki.fi
Thu Mar 24 18:47:16 UTC 2011


The following commit has been merged in the master branch:
commit a73774c8330e7fc1d4b917d31a87897804a47265
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Mar 24 20:45:16 2011 +0200

    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.

diff --git a/completions/java b/completions/java
index 4e0ae9c..73a8890 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 842501d..e41dbcc 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

-- 
bash-completion



More information about the Bash-completion-commits mailing list