diff options
author | Frank Terbeck <ft@bewatermyfriend.org> | 2011-06-02 10:50:35 +0200 |
---|---|---|
committer | Frank Terbeck <ft@bewatermyfriend.org> | 2011-06-02 10:50:35 +0200 |
commit | 2438a0e95aa448f0aeda468752444306b44fe7d0 (patch) | |
tree | 8477e9c6af360f6a89af13e8cb5f2a4f9c1cff2c /Completion/bashcompinit | |
parent | b495ba1e5a3ab1396844490ad8cad17dec23d6c1 (diff) | |
parent | 21266db1d9ae433bf1dcb196a4e258c00541b599 (diff) | |
download | zsh-2438a0e95aa448f0aeda468752444306b44fe7d0.tar.gz zsh-2438a0e95aa448f0aeda468752444306b44fe7d0.zip |
Merge commit 'zsh-4.3.12' into debian
Diffstat (limited to 'Completion/bashcompinit')
-rw-r--r-- | Completion/bashcompinit | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/Completion/bashcompinit b/Completion/bashcompinit index cba436a55..63101a9c8 100644 --- a/Completion/bashcompinit +++ b/Completion/bashcompinit @@ -12,14 +12,14 @@ _bash_complete() { (( COMP_CWORD = CURRENT - 1)) COMP_WORDS=( $words ) BASH_VERSINFO=( 2 05b 0 1 release ) - + savejobstates=( ${(kv)jobstates} ) savejobtexts=( ${(kv)jobtexts} ) - + [[ ${argv[${argv[(I)nospace]:-0}-1]} = -o ]] && suf=( -S '' ) - + matches=( ${(f)"$(compgen $@)"} ) - + if [[ -n $matches ]]; then if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]; then compset -P '*/' && matches=( ${matches##*/} ) @@ -41,11 +41,18 @@ _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 opts prefix suffix job OPTARG OPTIND ret=1 local -a name res results jids local -A shortopts - + emulate -L sh setopt kshglob noshglob braceexpand nokshautoload @@ -120,7 +127,13 @@ compgen() { ;; F) COMPREPLY=() - $OPTARG "${words[0]}" "${words[CURRENT-1]}" "${words[CURRENT-2]}" + (){ + set -- "${words[0]}" "${words[CURRENT-1]}" "${words[CURRENT-2]}" + # There may be more things we need to add to this typeset to + # protect bash functions from compsys special variable names + typeset -h words + $OPTARG "$@" + } results+=( "${COMPREPLY[@]}" ) ;; G) @@ -128,7 +141,7 @@ compgen() { results+=( ${~OPTARG} ) unsetopt nullglob ;; - W) eval "results+=( $OPTARG )" ;; + W) _compgen_opt_words "$OPTARG" "${@[-1]}" ;; C) results+=( $(eval $OPTARG) ) ;; P) prefix="$OPTARG" ;; S) suffix="$OPTARG" ;; |