[Bash-completion-commits] [SCM] bash-completion branch, master, updated. e8d84b300471944e6413bd9f6312dd57ee27b922

Freddy Vulto fvulto at gmail.com
Tue Oct 5 19:43:01 UTC 2010


The following commit has been merged in the master branch:
commit e8d84b300471944e6413bd9f6312dd57ee27b922
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Tue Oct 5 21:39:58 2010 +0200

    Bugfix __reassemble_comp_words_by_ref
    a b:c |<TAB> (with |=cursor) did not return `b:c' as `prev' on bash-4.1
    (Alioth #312740)

diff --git a/bash_completion b/bash_completion
index e88c662..a34015c 100644
--- a/bash_completion
+++ b/bash_completion
@@ -308,7 +308,7 @@ __reassemble_comp_words_by_ref() {
             ref="$2[$j]"
             eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
             # Indicate new cword
-            [[ $i == $COMP_CWORD && ${COMP_WORDS[i]} ]] && eval $3=$j
+            [[ $i == $COMP_CWORD ]] && eval $3=$j
         done
     else
         # No, list of word completions separators hasn't changed;
diff --git a/test/unit/_get_comp_words_by_ref.exp b/test/unit/_get_comp_words_by_ref.exp
index c88ad6f..cb3f4da 100644
--- a/test/unit/_get_comp_words_by_ref.exp
+++ b/test/unit/_get_comp_words_by_ref.exp
@@ -202,6 +202,21 @@ assert_bash_list {"c: b"} $cmd $test
 sync_after_int
 
 
+set test {a b:c | with WORDBREAKS -= :};  # | = cursor position
+if {[lindex $::BASH_VERSINFO 0] <= 3} {
+    set cmd {COMP_WORDS=(a b:c ''); COMP_CWORD=2}
+} else {
+    set cmd {COMP_WORDS=(a b : c ''); COMP_CWORD=4}
+}
+append cmd {; COMP_LINE='a b:c '; COMP_POINT=6}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
+assert_bash_list {" b:c"} $cmd $test
+
+
+sync_after_int
+
+
 set test {a :| with WORDBREAKS -= : should return :};  # | = cursor position
 set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3}
 assert_bash_exec $cmd

-- 
bash-completion



More information about the Bash-completion-commits mailing list