From d8f703027345170c7bc820ed7808e693dd1377d6 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sat, 25 Mar 2000 00:21:44 +0000 Subject: zsh-3.1.6-dev-20 --- Completion/Builtins/.distfiles | 8 +++--- Completion/Builtins/_zstyle | 4 +-- Completion/Commands/_next_tags | 45 +++---------------------------- Completion/Core/.distfiles | 4 +-- Completion/Core/_description | 5 ++-- Completion/Core/_main_complete | 36 ++++++++++++++++++++----- Completion/Core/_path_files | 7 +++-- Completion/Core/_prefix | 2 +- Completion/Core/_setup | 2 +- Completion/Core/_tags | 60 +++++++++++++----------------------------- Completion/User/.distfiles | 6 ++--- Completion/User/_groups | 3 +-- Completion/User/_mailboxes | 5 ++-- Completion/X/.distfiles | 8 +++--- Completion/X/_x_colormapid | 4 +-- Completion/X/_xwit | 4 +-- 16 files changed, 82 insertions(+), 121 deletions(-) (limited to 'Completion') diff --git a/Completion/Builtins/.distfiles b/Completion/Builtins/.distfiles index e142d0e08..389b73910 100644 --- a/Completion/Builtins/.distfiles +++ b/Completion/Builtins/.distfiles @@ -1,8 +1,8 @@ DISTFILES_SRC=' .distfiles _aliases _arrays _autoload _bg_jobs _bindkey _builtin _cd _command - _compdef _disable _echotc _enable _fc _fg_jobs _functions _hash _kill - _limits _nothing _pids _popd _sched _set _setopt _source _stat _trap - _unhash _unsetopt _vars _vars_eq _wait _which _zftp _zle _zmodload - _signals _zstyle + _compdef _disable _echotc _enable _fc _fg_jobs _functions + _hash _kill _limits _nothing _pids _popd _sched _set _setopt _source + _stat _trap _unhash _unsetopt _vars _vars_eq _wait _which _zftp _zle + _zmodload _zpty _signals _zstyle ' diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle index 40a66a364..9f5b0be89 100644 --- a/Completion/Builtins/_zstyle +++ b/Completion/Builtins/_zstyle @@ -49,13 +49,13 @@ styles=( packageset c:packageset path 'c:_wanted directories expl directory _path_files -/' ports c:_ports + prefer-ignored c:bool prefix-hidden c:bool prefix-needed c:bool prompt c: remove-all-dups c:bool single-ignored c:single-ignored sort c:bool - tag-aliases c:tag tag-order c:tag special-dirs c:sdirs squeeze-slashes c:bool @@ -215,7 +215,7 @@ while [[ -n $state ]]; do ;; single-ignored) - _wanted values expl 'how to handle a single ignored match' \ + _wanted values expl 'how to handle single alternate match' \ compadd - show menu ;; diff --git a/Completion/Commands/_next_tags b/Completion/Commands/_next_tags index 6d3389ff1..028ba4d61 100644 --- a/Completion/Commands/_next_tags +++ b/Completion/Commands/_next_tags @@ -46,7 +46,7 @@ _next_tags_pre() { # Helper function for sorting tags. Most of this is copied from _tags. _next_tags_sort() { - local order tags tag nodef tmp tmp2 + local order tags tag nodef if ! zstyle -a ":completion:${curcontext}:" tag-order order; then if (( $+_comp_default_tags )); then @@ -69,49 +69,12 @@ _next_tags_sort() { case $tag in -) nodef=yes;; *\(\)) "${${tag%%[ ]#\(\)}##[ ]#}" "$@";; - \!*) comptry "${(@)argv:#(${(j:|:)~${=~tag[2,-1]}})}";; - ?*) tmp=( ${${(s: :)${tag//\\\\ /$'\0'}}//$'\0'/ } ) tmp2=() tmp3=() - for tag in "$tmp[@]"; do - if [[ "$tag" = *:* ]]; then - tmp2=( "$tmp2[@]" "${(@M)^argv:#${~tag%%:*}}:${tag#*:}" ) - else - for atag in "${(@M)argv:#${~tag}}"; do - if zstyle -a ":completion:${curcontext}:${atag}" tag-aliases als; then - tmp3=( "$tmp3[@]" "$als[@]" ) - tmp=( "${(@)tmp:#${atag}}" ) - else - tmp2=( "$tmp2[@]" "$atag" ) - fi - done - fi - done - - comptry "${(@)tmp2:#(${(j:|:)~${(q)tmp%%:*}})}" "$tmp3[@]" "$tmp[@]" - ;; + \!*) comptry "${(@)argv:#(${(j:|:)~${=tag[2,-1]}})}";; + ?*) comptry ${=tag};; esac done - if [[ -z "$nodef" ]]; then - if (( $+_comp_default_tags )); then - for tag in "$_comp_default_tags[@]"; do - if zstyle -a ":completion:${curcontext}:${tag}" tag-aliases als; then - comptry "$als[@]" - else - comptry "$tag" - fi - done - else - tmp2=() - for tag; do - if zstyle -a ":completion:${curcontext}:${tag}" tag-aliases als; then - tmp2=( "$tmp2[@]" "$als[@]" ) - else - tmp2=( "$tmp2[@]" "$tag" ) - fi - done - comptry "$tmp2[@]" - fi - fi + [[ -z "$nodef" ]] && comptry "$@" } [[ -o kshautoload ]] || _next_tags "$@" diff --git a/Completion/Core/.distfiles b/Completion/Core/.distfiles index 0c85315fb..237018b27 100644 --- a/Completion/Core/.distfiles +++ b/Completion/Core/.distfiles @@ -1,10 +1,10 @@ DISTFILES_SRC=' .distfiles _alternative _approximate _call _compalso _complete _correct _description - _expand _files _funcall _list _main_complete _match + _expand _files _funcall _list _loop _main_complete _match _menu _multi_parts _message _normal _oldlist _options _parameters _path_files _prefix _requested _sep_parts - _set_options _setup _sort_tags _tags + _set_options _setup _sort_tags _tags _try _unset_options _wanted compdump compinit compinstall ' diff --git a/Completion/Core/_description b/Completion/Core/_description index 7db47228b..6326d1f03 100644 --- a/Completion/Core/_description +++ b/Completion/Core/_description @@ -29,9 +29,8 @@ zstyle -s ":completion:${curcontext}:$1" matcher match && opts=($opts -M "${(q)match}") [[ -n "$_matcher" ]] && opts=($opts -M "${(q)_matcher}") -if [[ -z "$_comp_no_ignore" ]] && - zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then - opts=( $opts -F _comp_ignore ) +if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then + opts=( $opts -F _comp_ignore) else _comp_ignore=() fi diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete index 49e66cba7..244f06b7e 100644 --- a/Completion/Core/_main_complete +++ b/Completion/Core/_main_complete @@ -19,7 +19,7 @@ setopt localoptions nullglob rcexpandparam extendedglob unsetopt markdirs globsubst shwordsplit nounset ksharrays -local func funcs ret=1 tmp _compskip format _comp_ignore \ +local ctxt func funcs ret=1 tmp _compskip format _comp_ignore \ _completers _completer _completer_num curtag \ _matchers _matcher _matcher_num _comp_tags \ context state line opt_args val_args curcontext="$curcontext" \ @@ -61,8 +61,7 @@ _last_menu_style=() # Get the names of the completers to use in the positional parameters. -(( $# )) || zstyle -a ":completion:${curcontext}:" completer argv || - set _complete +(( $# )) || zstyle -a ":completion:${curcontext}:" completer argv || set _complete # And now just call the completer functions defined. @@ -78,8 +77,14 @@ for func in "$funcs[@]"; do done for _completer; do + ctxt=":completion:${curcontext/::/:${_completer[2,-1]}-${(M)#_completers[1,_completer_num]:#$_completer}:}:" - zstyle -a ":completion:${curcontext/::/:${_completer[2,-1]}-${(M)#_completers[1,_completer_num]:#$_completer}:}:" matcher-list _matchers || + if zstyle -t "$ctxt" prefer-ignored && (( $compstate[alternate_nmatches] )); then + ret=0 + break; + fi + + zstyle -a "$ctxt" matcher-list _matchers || _matchers=( '' ) _matcher_num=1 @@ -93,9 +98,26 @@ for _completer; do (( _completer_num++ )) done +if zstyle -s ":completion:${curcontext}:" single-ignored tmp && + [[ $compstate[old_list] != shown && + $compstate[alternate_nmatches] = 1 ]]; then + case "$tmp" in + show) compstate[insert]='' compstate[list]='list force' tmp='' ;; + menu) + local expl + + compstate[insert]='menu' + _description original expl original + compadd "$expl[@]" -a -S '' - "$PREFIX$SUFFIX" + ;; + *) tmp='' ;; + esac +fi + if [[ -n "$tmp" || $compstate[old_list] = keep || - $compstate[nmatches] -gt 1 ]]; then - [[ _last_nmatches -ge 0 && _last_nmatches -ne $compstate[nmatches] ]] && + $compstate[nmatches]+$compstate[alternate_nmatches] -gt 1 ]]; then + [[ _last_nmatches -ge 0 && + _last_nmatches -ne $compstate[nmatches]+$compstate[alternate_nmatches] ]] && _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" ) if [[ "$compstate[insert]" = "$_saved_insert" ]]; then @@ -148,7 +170,7 @@ if [[ -n "$tmp" || $compstate[old_list] = keep || fi fi fi -elif [[ $compstate[nmatches] -eq 0 && +elif [[ $compstate[nmatches]+$compstate[alternate_nmatches] -eq 0 && $#_lastdescr -ne 0 && $compstate[old_list] != keep ]] && zstyle -s ":completion:${curcontext}:warnings" format format; then diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index 11445c204..d5feaa540 100644 --- a/Completion/Core/_path_files +++ b/Completion/Core/_path_files @@ -142,9 +142,8 @@ eorig="$orig" # If given no `-F' option, we may want to use $fignore, turned into patterns. -[[ -z "$_comp_no_ignore" && $#ignore -eq 0 && - ( -z $gopt || "$pats" = \ #\*\ # ) && -n $FIGNORE ]] && - ignore=( "?*${^fignore[@]}" ) +[[ $#ignore -eq 0 && ( -z $gopt || "$pats" = \ #\*\ # ) && -n $FIGNORE ]] && + ignore=( "?*${^fignore[@]}" ) if (( $#ignore )); then _comp_ignore=( "$_comp_ignore[@]" "$ignore[@]" ) @@ -351,7 +350,7 @@ for prepath in "$prepaths[@]"; do continue 2 fi - if [[ -z "$_comp_no_ignore" && "$tpre$tsuf" != */* && $#tmp1 -ne 0 ]] && + if [[ "$tpre$tsuf" != */* && $#tmp1 -ne 0 ]] && zstyle -s ":completion:${curcontext}:files" ignore-parents rem && [[ ( "$rem" != *dir* || "$pats" = '*(-/)' ) && ( "$rem" != *..* || "$tmp1" = *../* ) ]]; then diff --git a/Completion/Core/_prefix b/Completion/Core/_prefix index 32ffaea2f..ed95140bd 100644 --- a/Completion/Core/_prefix +++ b/Completion/Core/_prefix @@ -7,7 +7,7 @@ local curcontext="${curcontext/:[^:]#:/:prefix-${(M)#_completers[1,_completer_num]:#_prefix}:}" comp i zstyle -a ":completion:${curcontext}:" completer comp || - comp=( "${(@)_completers[1,_completer_num-1][(R)_prefix,-1]}" ) + comp=( "${(@)_completers[1,_completer_num][(R)_prefix,-1]}" ) if zstyle -t ":completion:${curcontext}:" add-space; then ISUFFIX=" $SUFFIX" diff --git a/Completion/Core/_setup b/Completion/Core/_setup index ed7307e69..0b9e5d0a9 100644 --- a/Completion/Core/_setup +++ b/Completion/Core/_setup @@ -54,7 +54,7 @@ fi _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" ) if zstyle -a ":completion:${curcontext}:$1" menu val; then - _last_nmatches=$nm + _last_nmatches=$(( $nm + $compstate[alternate_nmatches] )) _last_menu_style=( "$val[@]" ) else _last_nmatches=-1 diff --git a/Completion/Core/_tags b/Completion/Core/_tags index a617776d4..2dfa56f9d 100644 --- a/Completion/Core/_tags +++ b/Completion/Core/_tags @@ -16,7 +16,7 @@ if (( $# )); then # We have arguments: the tags supported in this context. - local curcontext="$curcontext" order tag nodef tmp tmp2 tmp3 als atag + local curcontext="$curcontext" order tag nodef if [[ "$1" = -C?* ]]; then curcontext="${curcontext%:*}:${1[3,-1]}" @@ -51,13 +51,7 @@ if (( $# )); then if [[ -n "$_sort_tags" ]]; then "$_sort_tags" "$@" - else - zstyle -a ":completion:${curcontext}:" tag-order order || - if [[ "$*" = *(arguments|values)* || "$*" = *options* ]] ;then - order=( 'arguments values' options ) - else - order=() - fi + elif zstyle -a ":completion:${curcontext}:" tag-order order; then for tag in $order; do case $tag in @@ -67,49 +61,33 @@ if (( $# )); then break fi ;; - \!*) comptry "${(@)argv:#(${(j:|:)~${=~tag[2,-1]}})}";; - ?*) tmp=( ${${(s: :)${tag//\\\\ /$'\0'}}//$'\0'/ } ) tmp2=() tmp3=() - for tag in "$tmp[@]"; do - if [[ "$tag" = *:* ]]; then - tmp2=( "$tmp2[@]" "${(@M)^argv:#${~tag%%:*}}:${tag#*:}" ) - else - for atag in "${(@M)argv:#${~tag}}"; do - if zstyle -a ":completion:${curcontext}:${atag}" tag-aliases als; then - tmp3=( "$tmp3[@]" "$als[@]" ) - tmp=( "${(@)tmp:#${atag}}" ) - else - tmp2=( "$tmp2[@]" "$atag" ) - fi - done - fi - done - - comptry "${(@)tmp2:#(${(j:|:)~${(q)tmp%%:*}})}" "$tmp3[@]" "$tmp[@]" - ;; + \!*) comptry "${(@)argv:#(${(j:|:)~${=tag[2,-1]}})}";; + ?*) comptry ${${(ps: :)${tag//\\\\ /$'\0'}}//$'\0'/ };; esac done if [[ -z "$nodef" ]]; then if (( $+_comp_default_tags )); then for tag in "$_comp_default_tags[@]"; do - if zstyle -a ":completion:${curcontext}:${tag}" tag-aliases als; then - comptry "$als[@]" - else - comptry "$tag" - fi + comptry "$tag" done else - tmp2=() - for tag; do - if zstyle -a ":completion:${curcontext}:${tag}" tag-aliases als; then - tmp2=( "$tmp2[@]" "$als[@]" ) - else - tmp2=( "$tmp2[@]" "$tag" ) - fi - done - comptry "$tmp2[@]" + comptry "$@" fi fi + else + + # Use default tags... + + if (( $+_comp_default_tags )); then + for tag in "$_comp_default_tags[@]"; do + comptry "$tag" + done + else + comptry arguments values + comptry options + fi + comptry "$@" fi # Return non-zero if at least one set of tags should be used. diff --git a/Completion/User/.distfiles b/Completion/User/.distfiles index 7dafbfbca..a2e47a963 100644 --- a/Completion/User/.distfiles +++ b/Completion/User/.distfiles @@ -2,10 +2,10 @@ DISTFILES_SRC=' .distfiles _a2ps _archie _bison _bunzip2 _bzip2 _chown _compress _configure _cvs _dd _diff _diff_options _dir_list _dirs - _domains _dvi _find _finger _flex _gcc _gdb _gprof _groups + _domains _dvi _find _finger _flex _gcc _gdb _getconf _gprof _groups _gs _gunzip _gv _gzip _hosts _ispell _killall _lp _lynx - _mailboxes _make _man _mh _mount _mutt _my_accounts - _netscape _nslookup _other_accounts _pack _patch _pbm _pdf + _mailboxes _make _man _mh _mount _mutt _my_accounts _mysql_utils _nedit + _netscape _nslookup _other_accounts _pack _patch _pbm _pdf _perl _perl_basepods _perl_builtin_funcs _perl_modules _perldoc _ports _prcs _prompt _ps _pspdf _psutils _rcs _rlogin _sh _socket _ssh _strip _stty _su _sudo _tar _tar_archive _telnet _tex _texi diff --git a/Completion/User/_groups b/Completion/User/_groups index 748536f3b..c4d53d32d 100644 --- a/Completion/User/_groups +++ b/Completion/User/_groups @@ -6,8 +6,7 @@ _wanted groups || return 1 if ! zstyle -a ":completion:${curcontext}:" groups groups; then (( $+_cache_groups )) || - if (( ${+commands[ypcat]} )) && - tmp=$(_call groups ypcat group.byname); then + if (( ${+commands[ypcat]} )) && tmp=$(ypcat group.byname); then : ${(A)_cache_groups:=${${(f)tmp}%%:*}} # If you use YP else : ${(A)_cache_groups:=${${(s: :)$( ) && [[ -n "$j" ]]; then + elif j=( "$i"/<1-> ) && [[ -n "$j" ]]; then _mh_cache=( "${_mh_cache[@]}" "$i" ) else _mbox_cache=( "${_mbox_cache[@]}" "$i"/*(.) ) - dirboxes=( $dirboxes $i/*(/) ) + dirboxes=( $dirboxes "$i"/*(/) ) fi done diff --git a/Completion/X/.distfiles b/Completion/X/.distfiles index 475bba785..42c69d888 100644 --- a/Completion/X/.distfiles +++ b/Completion/X/.distfiles @@ -1,7 +1,7 @@ DISTFILES_SRC=' .distfiles - _x_arguments _x_borderwidth _x_color _x_cursor _x_display _x_extension - _x_font _x_geometry _x_keysym _x_locale _x_modifier _x_name _x_resource - _x_selection_timeout _x_title _x_window _xdvi _xfig _xmodmap _xrdb - _xt_arguments _xt_session_id _xterm _xutils _xv + _x_arguments _x_borderwidth _x_color _x_colormapid _x_cursor _x_display + _x_extension _x_font _x_geometry _x_keysym _x_locale _x_modifier + _x_name _x_resource _x_selection_timeout _x_title _x_window _xdvi _xfig + _xmodmap _xrdb _xt_arguments _xt_session_id _xterm _xutils _xv _xwit ' diff --git a/Completion/X/_x_colormapid b/Completion/X/_x_colormapid index 20e82fa44..4fe6aac42 100644 --- a/Completion/X/_x_colormapid +++ b/Completion/X/_x_colormapid @@ -2,7 +2,7 @@ local expl list desc -_wanted colormapids || return 1 +_wanted colormapids expl 'colormap id' || return 1 list=(${(f)"$(xprop -root -f RGB_COLOR_MAP 32xcccccccxx ': $0\n'|awk -F'[ ():]' '/^[a-zA-Z_]+\(RGB_COLOR_MAP\)/ {print $5, "--", $1}')"}) @@ -12,4 +12,4 @@ else desc=() fi -_loop colormapids expl 'colormap id' compadd "$@" "$desc[@]" - "${(@)list%% *}" +compadd "$expl[@]" "$@" "$desc[@]" - "${(@)list%% *}" diff --git a/Completion/X/_xwit b/Completion/X/_xwit index 4a5242e18..5e14fec89 100644 --- a/Completion/X/_xwit +++ b/Completion/X/_xwit @@ -16,8 +16,8 @@ _xwit_guard () { _xwit_compopts () { local expl - _wanted options expl option compadd - ${(k)no[(R)*~0]} || - _loop options expl option compadd - ${(k)no} + _description options expl option + compadd "$expl[@]" - ${(k)no[(R)*~0]} || compadd "$expl[@]" - ${(k)no} } _regex_arguments _xwit_parse \ -- cgit 1.4.1