[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-70-g4ad538b

David Paleino dapal at debian.org
Tue Apr 12 20:07:03 UTC 2011


The following commit has been merged in the master branch:
commit 4ad538ba1a0ccb483899b4eaa70cc604d2b7bf78
Author: David Paleino <dapal at debian.org>
Date:   Tue Apr 12 22:06:12 2011 +0200

    Fix __get_cword_at_cursor_by_ref: check for $index when completing with a cword+1 argument already present (Debian: #622383)

diff --git a/CHANGES b/CHANGES
index 6eaa824..756c1d6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -19,6 +19,8 @@ bash-completion (2.x)
   * If _filedir 'ext' returns nothing, just fallback to generic
     file completion. Patch by Clint Byrum (Debian: #619014, LP: #533985)
   * Fix broken _allowed_groups usage (shadow and coreutils)
+  * Fix __get_cword_at_cursor_by_ref: check for $index when completing
+    with a cword+1 argument already present (Debian: #622383)
 
   [ Freddy Vulto ]
   * Improve __reassemble_comp_words_by_ref() to not create words of
diff --git a/bash_completion b/bash_completion
index 589016b..9d1e7ee 100644
--- a/bash_completion
+++ b/bash_completion
@@ -373,6 +373,12 @@ __get_cword_at_cursor_by_ref() {
         fi
     done
 
+    if [[ $index -lt 0 ]]; then
+        # This happens when completing: "command | arg" (| is where
+        # TAB is hit)
+        index=0
+    fi
+
     if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then
         # We messed up. At least return the whole word so things keep working
         cur2=${words[cword]}

-- 
bash-completion



More information about the Bash-completion-commits mailing list