diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/.distfiles | 7 | ||||
-rw-r--r-- | Completion/Builtins/.distfiles | 4 | ||||
-rw-r--r-- | Completion/Core/_multi_parts | 62 | ||||
-rw-r--r-- | Completion/Core/_path_files | 35 | ||||
-rw-r--r-- | Completion/Core/_sep_parts | 6 |
5 files changed, 36 insertions, 78 deletions
diff --git a/Completion/Base/.distfiles b/Completion/Base/.distfiles index 14bab9676..1c2c49fa2 100644 --- a/Completion/Base/.distfiles +++ b/Completion/Base/.distfiles @@ -1,6 +1,7 @@ DISTFILES_SRC=' .distfiles - _arg_compile _arguments _brace_parameter _command_names _condition - _default _describe _equal _first _math _parameter _precommand _redirect - _regex_arguments _subscript _tilde _values _vars + _arguments _brace_parameter _command_names + _condition _default _equal _first + _math _parameter _precommand _redirect _regex_arguments _subscript + _tilde _values _vars ' diff --git a/Completion/Builtins/.distfiles b/Completion/Builtins/.distfiles index 633dc2d01..e0d0f3e99 100644 --- a/Completion/Builtins/.distfiles +++ b/Completion/Builtins/.distfiles @@ -1,7 +1,7 @@ DISTFILES_SRC=' .distfiles _aliases _arrays _autoload _bg_jobs _bindkey _builtin _cd _command - _compdef _disable _echotc _enable _fc _functions _hash _jobs _kill + _dirs _disable _echotc _enable _fc _functions _hash _jobs _kill _limits _sched _set _setopt _source _stat _trap _unhash _unsetopt - _vars_eq _wait _which _zftp _zle _zmodload + _vars_eq _wait _which _zftp _zle _zmodload ' diff --git a/Completion/Core/_multi_parts b/Completion/Core/_multi_parts index 30a68d312..d51130391 100644 --- a/Completion/Core/_multi_parts +++ b/Completion/Core/_multi_parts @@ -7,7 +7,7 @@ # The parts of words from the array that are separated by the # separator character are then completed independently. -local sep matches pref npref i tmp1 group expl menu pre suf opre osuf cpre +local sep matches pref npref i tmp1 group expl menu pre suf typeset -U tmp2 # Get the options. @@ -40,8 +40,6 @@ fi pre="$PREFIX" suf="$SUFFIX" -opre="$PREFIX" -osuf="$SUFFIX" orig="$PREFIX$SUFFIX" # Special handling for menucompletion? @@ -102,17 +100,14 @@ while true; do matches=( "${(@M)matches:#${tmp1[1]}*}" ) tmp2=( "${(@M)matches:#${tmp1[1]}${sep}*}" ) - PREFIX="${cpre}${pre}" - SUFFIX="$suf" - if (( $#tmp2 )); then - compadd "$group[@]" "$expl[@]" -p "$pref" -qS "$sep" \ - -M "r:|${sep}=* r:|=*" - "$tmp1[1]" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -p "$pref" -qS "$sep" - "$tmp1[1]" else - compadd "$group[@]" "$expl[@]" -p "$pref" \ - -M "r:|${sep}=* r:|=*" - "$tmp1[1]" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -p "$pref" - "$tmp1[1]" fi - return 0 + return 1 fi elif (( $#tmp1 )); then @@ -123,14 +118,6 @@ while true; do SUFFIX="$suf" compadd -O matches -M "r:|${sep}=* r:|=*" - "$matches[@]" - if [[ "$pre" = *${sep}* ]]; then - PREFIX="${cpre}${pre%%${sep}*}" - SUFFIX="${sep}${pre#*${sep}}${suf}" - else - PREFIX="${cpre}${pre}" - SUFFIX="$suf" - fi - if [[ -n "$menu" ]]; then # With menucompletion we just add matches for the matching # components with the prefix we collected and the rest from the @@ -138,12 +125,11 @@ while true; do tmp2="$pre$suf" if [[ "$tmp2" = *${sep}* ]]; then - compadd "$group[@]" "$expl[@]" \ - -p "$pref" -s "${sep}${tmp2#*${sep}}" \ - -M "r:|${sep}=* r:|=*" - "$tmp1[@]" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -p "$pref" -s "${sep}${tmp2#*${sep}}" - "$tmp1[@]" else - compadd "$group[@]" "$expl[@]" -p "$pref"\ - -M "r:|${sep}=* r:|=*" - "$tmp1[@]" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -p "$pref" - "$tmp1[@]" fi else # With normal completion we add all matches one-by-one with @@ -152,12 +138,11 @@ while true; do for i in "${(@M)matches:#(${(j:|:)~tmp1})*}"; do if [[ "$i" = *${sep}* ]]; then - compadd "$group[@]" "$expl[@]" -S '' \ - -p "$pref" -s "${i#*${sep}}" \ - -M "r:|${sep}=* r:|=*" - "${i%%${sep}*}${sep}" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -S '' -p "$pref" -s "${i#*${sep}}" - "${i%%${sep}*}${sep}" else - compadd "$group[@]" "$expl[@]" -S '' -p "$pref" \ - -M "r:|${sep}=* r:|=*" - "$i" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -S '' -p "$pref" - "$i" fi done fi @@ -169,15 +154,12 @@ while true; do [[ "$orig" = "$pref$pre$suf" ]] && return 1 - PREFIX="${cpre}${pre}" - SUFFIX="$suf" - if [[ -n "$suf" ]]; then - compadd "$group[@]" "$expl[@]" -s "$suf" \ - -M "r:|${sep}=* r:|=*" - "$pref$pre" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -s "$suf" - "$pref$pre" else - compadd "$group[@]" "$expl[@]" -S '' \ - -M "r:|${sep}=* r:|=*" - "$pref$pre" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -S '' - "$pref$pre$suf" fi return 0 fi @@ -193,10 +175,8 @@ while true; do # Now we set `pre' and `suf' to their new values. if [[ "$pre" = *${sep}* ]]; then - cpre="${cpre}${pre%%${sep}*}${sep}" pre="${pre#*${sep}}" elif [[ "$suf" = *${sep}* ]]; then - cpre="${cpre}${pre}${suf%%${sep}*}${sep}" pre="${suf#*${sep}}" suf="" else @@ -204,11 +184,9 @@ while true; do # unambiguous prefix and that differs from the original string, # we insert it. - PREFIX="${opre}${osuf}" - SUFFIX="" - [[ -n "$pref" && "$orig" != "$pref" ]] && - compadd "$group[@]" "$expl[@]" -S '' -M "r:|${sep}=* r:|=*" - "$pref" + compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -S '' - "$pref" return fi diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index b4b6fff97..b017d78e5 100644 --- a/Completion/Core/_path_files +++ b/Completion/Core/_path_files @@ -24,7 +24,7 @@ # menucompletion. local linepath realpath donepath prepath testpath exppath -local tmp1 tmp2 tmp3 tmp4 i orig pre suf tpre tsuf opre osuf cpre +local tmp1 tmp2 tmp3 tmp4 i orig pre suf tpre tsuf local pats haspats=no ignore group expl addpfx addsfx remsfx local nm=$compstate[nmatches] menu @@ -118,8 +118,6 @@ fi pre="$PREFIX" suf="$SUFFIX" -opre="$PREFIX" -osuf="$SUFFIX" orig="${PREFIX}${SUFFIX}" [[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" || @@ -293,8 +291,6 @@ for prepath in "$prepaths[@]"; do if [[ "$haspats" = no && -z "$tpre$tsuf" && "$pre" = */ && -z "$suf" ]]; then - PREFIX="${opre}${osuf}" - SUFFIX="" compadd -nQS '' - "$linepath$donepath$orig" tmp4=- fi @@ -353,27 +349,19 @@ for prepath in "$prepaths[@]"; do # collected as the suffixes to make the completion code expand # it as far as possible. - if [[ "$tmp3" = */* ]]; then - PREFIX="${linepath}${cpre}${tmp3%%/*}" - SUFFIX="/${tmp3#*/}" - else - PREFIX="${linepath}${cpre}${tmp3}" - SUFFIX="" - fi - if [[ -n $menu ]]; then [[ -n "$compconfig[path_cursor]" ]] && compstate[to_end]='' if [[ "$tmp3" = */* ]]; then compadd -QUf -p "$linepath${testpath:q}" -s "/${tmp3#*/}" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" -M 'r:|/=* r:|=*' \ -+ "$group[@]" "$expl[@]" \ + "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ - "${(@)${(@)tmp1%%/*}:q}" else compadd -QUf -p "$linepath${testpath:q}" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ - "$group[@]" "$expl[@]" \ + "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ - "${(@)tmp1:q}" fi else @@ -382,14 +370,14 @@ for prepath in "$prepaths[@]"; do compadd -QUf -p "$linepath${testpath:q}" -s "/${${i#*/}:q}" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" -M 'r:|/=* r:|=*' \ - "$group[@]" "$expl[@]" \ + "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ - "${${i%%/*}:q}" done else compadd -QUf -p "$linepath${testpath:q}" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ - "$group[@]" "$expl[@]" \ + "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ - "${(@)tmp1:q}" fi fi @@ -411,17 +399,14 @@ for prepath in "$prepaths[@]"; do testpath="${testpath}${tmp1[1]%%/*}/" tmp1=( "${(@)tmp1#*/}" ) - cpre="${cpre}${tmp3%%/*}/" tmp3="${tmp3#*/}" done - if [[ -z "$tmp4" ]]; then - PREFIX="${opre}${osuf}" - SUFFIX="" - compadd -QUf -p "$linepath${testpath:q}" \ + if [[ -z "$tmp4" ]]; then + compadd -QUf -p "$linepath${testpath:q}" \ -W "$prepath$realpath$testpath" "$ignore[@]" \ "$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \ - "$group[@]" "$expl[@]" \ + "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ - "${(@)tmp1:q}" fi done @@ -434,9 +419,7 @@ exppaths=( "${(@)exppaths:#$orig}" ) if [[ -n "$compconfig[path_expand]" && $#exppaths -gt 0 && nm -eq compstate[nmatches] ]]; then - PREFIX="${opre}${osuf}" - SUFFIX="" - compadd -Q -S '' "$group[@]" "$expl[@]" \ + compadd -QU -S '' "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ -M 'r:|/=* r:|=*' -p "$linepath" - "$exppaths[@]" fi diff --git a/Completion/Core/_sep_parts b/Completion/Core/_sep_parts index 0a8cae28f..6f2595120 100644 --- a/Completion/Core/_sep_parts +++ b/Completion/Core/_sep_parts @@ -18,7 +18,7 @@ # `-X explanation' options. local str arr sep test testarr tmparr prefix suffixes matchers autosuffix -local matchflags opt group expl nm=$compstate[nmatches] opre osuf +local matchflags opt group expl nm=$compstate[nmatches] # Get the options. @@ -34,8 +34,6 @@ shift OPTIND-1 # Get the string from the line. -opre="$PREFIX" -osuf="$SUFFIX" str="$PREFIX$SUFFIX" SUFFIX="" prefix="" @@ -146,8 +144,6 @@ done # Add the matches for each of the suffixes. -PREFIX="$pre" -SUFFIX="$suf" for i in "$suffixes[@]"; do compadd -U "$group[@]" "$expl[@]" "$matchers[@]" "$autosuffix[@]" \ -i "$IPREFIX" -I "$ISUFFIX" -p "$prefix" -s "$i" - "$testarr[@]" |