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

Guillaume Rousse guillaume at oberkampf.msr-inria.inria.fr
Sun Jan 3 18:03:15 UTC 2010


The following commit has been merged in the master branch:
commit 2cf62de30899d4ecd9321f59b80b8da441c3e897
Author: Guillaume Rousse <guillaume at oberkampf.msr-inria.inria.fr>
Date:   Sun Jan 3 19:01:56 2010 +0100

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

diff --git a/bash_completion b/bash_completion
index b2ad64a..05f1293 100644
--- a/bash_completion
+++ b/bash_completion
@@ -326,7 +326,12 @@ _get_cword()
 # COMP_WORDBREAKS.
 # @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

-- 
bash-completion



More information about the Bash-completion-commits mailing list