summaryrefslogtreecommitdiffstats
path: root/Completion/bashcompinit
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/bashcompinit')
-rw-r--r--Completion/bashcompinit28
1 files changed, 11 insertions, 17 deletions
diff --git a/Completion/bashcompinit b/Completion/bashcompinit
index 63101a9c8..6cc3be580 100644
--- a/Completion/bashcompinit
+++ b/Completion/bashcompinit
@@ -8,7 +8,7 @@ _bash_complete() {
local COMP_LINE="$words"
local -A savejobstates savejobtexts
- (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
+ (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX ))
(( COMP_CWORD = CURRENT - 1))
COMP_WORDS=( $words )
BASH_VERSINFO=( 2 05b 0 1 release )
@@ -18,15 +18,15 @@ _bash_complete() {
[[ ${argv[${argv[(I)nospace]:-0}-1]} = -o ]] && suf=( -S '' )
- matches=( ${(f)"$(compgen $@)"} )
+ matches=( ${(f)"$(compgen $@ -- ${words[CURRENT]})"} )
if [[ -n $matches ]]; then
if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]; then
compset -P '*/' && matches=( ${matches##*/} )
compset -S '/*' && matches=( ${matches%%/*} )
- compadd -f "${suf[@]}" -a matches && ret=0
+ compadd -Q -f "${suf[@]}" -a matches && ret=0
else
- compadd "${suf[@]}" -a matches && ret=0
+ compadd -Q "${suf[@]}" -a matches && ret=0
fi
fi
@@ -41,18 +41,12 @@ _bash_complete() {
return ret
}
-_compgen_opt_words() {
- typeset -a words
- words=( ${~=1} )
- local find="$2"
- results=(${(M)words[@]:#$find*})
-}
-
compgen() {
local opts prefix suffix job OPTARG OPTIND ret=1
local -a name res results jids
local -A shortopts
+ # words changes behavior: words[1] -> words[0]