protect against error when used in history context (COMP_CWORD=0)

This commit is contained in:
Guillaume Rousse 2010-01-03 19:01:56 +01:00
parent ed3a2f7786
commit 2cf62de308

View File

@ -326,7 +326,12 @@ _get_cword()
# COMP_WORDBREAKS. # COMP_WORDBREAKS.
# @see _get_cword() # @see _get_cword()
# #
_get_pword() { _get_cword "${@:-}" 1; } _get_pword()
{
if [ $COMP_CWORD -ge 1 ]; then
_get_cword "${@:-}" 1;
fi
}
# If the word-to-complete contains a colon (:), left-trim COMPREPLY items with # If the word-to-complete contains a colon (:), left-trim COMPREPLY items with