summaryrefslogtreecommitdiff
path: root/bash_completion
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2011-04-12 22:06:12 +0200
committerDavid Paleino <dapal@debian.org>2011-04-12 22:06:12 +0200
commit4ad538ba1a0ccb483899b4eaa70cc604d2b7bf78 (patch)
treeb775aef35d7f1d99911d5f5956f3ee3214ab3ce3 /bash_completion
parent7c34b562677b9c8b8075cee0f080bcbca34d484e (diff)
downloadbash-completion-4ad538ba1a0ccb483899b4eaa70cc604d2b7bf78.tar.gz
Fix __get_cword_at_cursor_by_ref: check for $index when completing with a cword+1 argument already present (Debian: #622383)
Diffstat (limited to 'bash_completion')
-rw-r--r--bash_completion6
1 files changed, 6 insertions, 0 deletions
diff --git a/bash_completion b/bash_completion
index 589016b9..9d1e7ee7 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]}