diff options
author | Freddy Vulto <fvulto@gmail.com> | 2009-12-10 21:28:24 +0100 |
---|---|---|
committer | Freddy Vulto <fvulto@gmail.com> | 2009-12-10 21:28:24 +0100 |
commit | b1e58b1a0e4fdd88df3d1a3feae9adea8cc4e350 (patch) | |
tree | 4b09997ad06db478acd9753c2bb4b89318425b33 /bash_completion | |
parent | 0f25d9c66f43a01ac793e040e1ca123a13b24adc (diff) | |
download | bash-completion-b1e58b1a0e4fdd88df3d1a3feae9adea8cc4e350.tar.gz |
Fix __reassemble_comp_words_by_ref()
If a word is made up of multiple word separator characters:
$ a b::<TAB> # CWORDS are: a, b, and :: (correct)
__reassemble_comp_words_by_ref() couldn't handle this. It assumed CWORDS were:
$ a b::<TAB> # CWORDS: a, b, : and : (but they're not)
Added test case for this. To run the automated tests:
./runUnit _get_cword.exp
Diffstat (limited to 'bash_completion')
-rw-r--r-- | bash_completion | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bash_completion b/bash_completion index d82b287d..7e3403c3 100644 --- a/bash_completion +++ b/bash_completion @@ -234,9 +234,9 @@ __reassemble_comp_words_by_ref() { # Yes, list of word completion separators has shrunk; # Re-assemble words to complete for (( i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do - # Is current word not word 0 (the command itself) and is word of - # length 1 and is word newly excluded from being word separator? - while [[ $i -gt 0 && ${#COMP_WORDS[$i]} == 1 && ${COMP_WORDS[$i]//[^$exclude]} ]]; do + # Is current word not word 0 (the command itself) and is word made up of + # just word separators characters to be excluded? + while [[ $i -gt 0 && ${COMP_WORDS[$i]//[^$exclude]} ]]; do [ $j -ge 2 ] && ((j--)) # Append word separator to current word ref="$2[$j]" |