Skip to content

Commit

Permalink
bash_completion: fix array set checks with empty elements in them
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed May 30, 2020
1 parent f4fa0b6 commit efaa991
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ __get_cword_at_cursor_by_ref()
((index < 0)) && index=0
fi

local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 ${words:+"${words[@]}"} \
local "$2" "$3" "$4" && _upvars -a${#words[@]} $2 ${words+"${words[@]}"} \
-v $3 "$cword" -v $4 "${cur:0:index}"
}

Expand Down Expand Up @@ -416,7 +416,7 @@ _get_comp_words_by_ref()
}
[[ -v vwords ]] && {
upvars+=("$vwords")
upargs+=(-a${#words[@]} $vwords ${words:+"${words[@]}"})
upargs+=(-a${#words[@]} $vwords ${words+"${words[@]}"})
}

((${#upvars[@]})) && local "${upvars[@]}" && _upvars "${upargs[@]}"
Expand Down Expand Up @@ -606,7 +606,7 @@ _filedir()
[[ -n ${COMP_FILEDIR_FALLBACK-} && -n $arg && ${#toks[@]} -lt 1 ]] && {
reset=$(shopt -po noglob)
set -o noglob
toks+=($(compgen -f ${plusdirs:+"${plusdirs[@]}"} -- $quoted))
toks+=($(compgen -f ${plusdirs+"${plusdirs[@]}"} -- $quoted))
IFS=' '
$reset
IFS=$'\n'
Expand Down

0 comments on commit efaa991

Please sign in to comment.