1 diff -aur build-old/bash_completion build-new/bash_completion
2 --- build-old/bash_completion 2009-08-23 18:38:19.000000000 +1100
3 +++ build-new/bash_completion 2009-08-26 00:04:19.000000000 +1100
5 # for things like scp where we want to return host:path and not only path.
8 - if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
9 - printf "%s" "${COMP_WORDS[COMP_CWORD]}"
12 - local cur="$COMP_LINE"
13 - local index="$COMP_POINT"
14 - for (( i = 0; i <= COMP_CWORD; ++i )); do
15 - while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do
17 - index="$(( index - 1 ))"
19 - if [[ "$i" -lt "$COMP_CWORD" ]]; then
20 - local old_size="${#cur}"
21 - cur="${cur#${COMP_WORDS[i]}}"
22 - local new_size="${#cur}"
23 - index="$(( index - old_size + new_size ))"
27 + local WORDBREAKS=${COMP_WORDBREAKS}
29 + for (( i=0; i<${#1}; ++i )); do
30 + local char=${1:$i:1}
31 + WORDBREAKS=${WORDBREAKS//$char/}
34 - if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
35 - # We messed up! At least return the whole word so things
37 - printf "%s" "${COMP_WORDS[COMP_CWORD]}"
39 - printf "%s" "${cur:0:$index}"
42 + local cur=${COMP_LINE:0:$COMP_POINT}
44 + local word_start=`expr "$tmp" : '.*['"${WORDBREAKS}"']'`
45 + while [ "$word_start" -ge 2 ]; do
46 + local char=${cur:$(( $word_start - 2 )):1}
47 + if [ "$char" != "\\" ]; then
50 + tmp=${COMP_LINE:0:$(( $word_start - 2 ))}
51 + word_start=`expr "$tmp" : '.*['"${WORDBREAKS}"']'`
54 + cur=${cur:$word_start}
58 # This function performs file and directory completion. It's better than
59 Only in build-new: debian