__reassemble_comp_words_by_ref: Make work with failglob on (Alioth: #312741)
Based on a patch from Dams Nadé <alioth@livna.org>
This commit is contained in:
parent
41cdfc6510
commit
732906b250
@ -246,7 +246,7 @@ __reassemble_comp_words_by_ref()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Default to cword unchanged
|
# Default to cword unchanged
|
||||||
eval $3=$COMP_CWORD
|
printf -v "$3" %s "$COMP_CWORD"
|
||||||
# Are characters excluded which were former included?
|
# Are characters excluded which were former included?
|
||||||
if [[ $exclude ]]; then
|
if [[ $exclude ]]; then
|
||||||
# Yes, list of word completion separators has shrunk;
|
# Yes, list of word completion separators has shrunk;
|
||||||
@ -264,9 +264,9 @@ __reassemble_comp_words_by_ref()
|
|||||||
[[ $line != [$' \t']* ]] && (( j >= 2 )) && ((j--))
|
[[ $line != [$' \t']* ]] && (( j >= 2 )) && ((j--))
|
||||||
# Append word separator to current or new word
|
# Append word separator to current or new word
|
||||||
ref="$2[$j]"
|
ref="$2[$j]"
|
||||||
eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
|
printf -v "$ref" %s "${!ref}${COMP_WORDS[i]}"
|
||||||
# Indicate new cword
|
# Indicate new cword
|
||||||
[[ $i == $COMP_CWORD ]] && eval $3=$j
|
[[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j"
|
||||||
# Remove optional whitespace + word separator from line copy
|
# Remove optional whitespace + word separator from line copy
|
||||||
line=${line#*"${COMP_WORDS[$i]}"}
|
line=${line#*"${COMP_WORDS[$i]}"}
|
||||||
# Start new word if word separator in original line is
|
# Start new word if word separator in original line is
|
||||||
@ -278,16 +278,18 @@ __reassemble_comp_words_by_ref()
|
|||||||
done
|
done
|
||||||
# Append word to current word
|
# Append word to current word
|
||||||
ref="$2[$j]"
|
ref="$2[$j]"
|
||||||
eval $2[$j]=\${!ref}\${COMP_WORDS[i]}
|
printf -v "$ref" %s "${!ref}${COMP_WORDS[i]}"
|
||||||
# Remove optional whitespace + word from line copy
|
# Remove optional whitespace + word from line copy
|
||||||
line=${line#*"${COMP_WORDS[i]}"}
|
line=${line#*"${COMP_WORDS[i]}"}
|
||||||
# Indicate new cword
|
# Indicate new cword
|
||||||
[[ $i == $COMP_CWORD ]] && eval $3=$j
|
[[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j"
|
||||||
done
|
done
|
||||||
[[ $i == $COMP_CWORD ]] && eval $3=$j
|
[[ $i == $COMP_CWORD ]] && printf -v "$3" %s "$j"
|
||||||
else
|
else
|
||||||
# No, list of word completions separators hasn't changed;
|
# No, list of word completions separators hasn't changed;
|
||||||
eval $2=\( \"\${COMP_WORDS[@]}\" \)
|
for i in ${!COMP_WORDS[@]}; do
|
||||||
|
printf -v "$2[i]" %s "${COMP_WORDS[i]}"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
} # __reassemble_comp_words_by_ref()
|
} # __reassemble_comp_words_by_ref()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user