From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24250 invoked from network); 3 Dec 1999 15:12:36 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Dec 1999 15:12:36 -0000 Received: (qmail 13203 invoked by alias); 3 Dec 1999 15:12:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8876 Received: (qmail 13196 invoked from network); 3 Dec 1999 15:12:26 -0000 Date: Fri, 3 Dec 1999 16:12:25 +0100 (MET) Message-Id: <199912031512.QAA00975@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: PATCH: cleanup in _expand and _approximate This makes them use _setup and better group names so that one can set styles for the matches added by them. Bye Sven diff -u -r oldcompletion/Core/_approximate Completion/Core/_approximate --- oldcompletion/Core/_approximate Fri Dec 3 15:08:21 1999 +++ Completion/Core/_approximate Fri Dec 3 15:42:48 1999 @@ -59,9 +59,9 @@ PREFIX="(#a${_comp_correct})$PREFIX" fi if [[ -n "$_correct_prompt" ]]; then - builtin compadd -X "$_correct_prompt" -J _correct "$@" + builtin compadd -X "$_correct_prompt" -J corrections "$@" else - builtin compadd -J _correct "$@" + builtin compadd -J corrections "$@" fi } @@ -78,6 +78,11 @@ _correct_prompt="${cfgps//\\%e/1}" +_setup original corrections + +[[ "$cfgorig" != *last* ]] && builtin compadd -V original +builtin compadd -J corrections + [[ -z "$compstate[pattern_match]" ]] && compstate[pattern_match]='*' while [[ _comp_correct -le comax ]]; do @@ -99,11 +104,7 @@ else expl=(-n) fi - if [[ "$cfgorig" = *last* ]]; then - builtin compadd "$expl[@]" -U -V _correct_original -Q - "$PREFIX$SUFFIX" - elif [[ -n "$cfgorig" ]]; then - builtin compadd "$expl[@]" -U -Q - "$PREFIX$SUFFIX" - fi + builtin compadd "$expl[@]" -U -V original -Q - "$PREFIX$SUFFIX" # If you always want to see the list of possible corrections, # set `compstate[list]=list' here. diff -u -r oldcompletion/Core/_expand Completion/Core/_expand --- oldcompletion/Core/_expand Fri Dec 3 15:08:22 1999 +++ Completion/Core/_expand Fri Dec 3 15:35:14 1999 @@ -82,7 +82,9 @@ # Quote the results and remove unnecessary quotes before `='s. - exp=( "${(@)${(@)${(@q)exp}//\\\\=/=}/#=/\\=}" ) +exp=( "${(@)${(@)${(@q)exp}//\\\\=/=}/#=/\\=}" ) + +_setup original expansions all-expansions # We have expansions, should we menucomplete them? @@ -93,15 +95,15 @@ # probably also adding the original string. if [[ -z "$compstate[insert]" ]]; then - compadd -U -V _expand -Q - "$exp[@]" + compadd -U -V all-expansions -Q - "$exp[@]" else [[ -n "$orig" && "$orig" != *last* ]] && - compadd "$expl[@]" -UQ -V _expand_original - "$word" + compadd "$expl[@]" -UQ -V original - "$word" compadd -UQ -V _expand - "$exp" [[ -n "$orig" && "$orig" = *last* ]] && - compadd "$expl[@]" -UQ -V _expand_original - "$word" + compadd "$expl[@]" -UQ -V original - "$word" compstate[insert]=menu fi @@ -114,22 +116,22 @@ # and/or the string containing all expanded string. [[ -n "$orig" && "$orig" != *last* ]] && - compadd "$expl[@]" -UQ -V _expand_original - "$word" + compadd "$expl[@]" -UQ -V original - "$word" [[ $#exp -ne 1 && "$menu" = *last* && "$menu" != *only* ]] && - compadd "$expl2[@]" -UQ -V _expand_all - "$exp" + compadd "$expl2[@]" -UQ -V all-expansions - "$exp" if [[ -z "$prompt" ]]; then - compadd -UQ $group _expand - "$exp[@]" + compadd -UQ $group expansions - "$exp[@]" else compadd -UQ -X "${prompt//\\%o/$word}" \ - $group _expand - "$exp[@]" + $group expansions - "$exp[@]" fi [[ $#exp -ne 1 && "$menu" != *last* && "$menu" != *only* ]] && - compadd "$expl2[@]" -UQ -V _expand_all - "$exp" + compadd "$expl2[@]" -UQ -V all-expansions - "$exp" [[ -n "$orig" && "$orig" = *last* ]] && - compadd "$expl[@]" -UQ -V _expand_original - "$word" + compadd "$expl[@]" -UQ -V original - "$word" compstate[insert]=menu fi diff -u -r oldcompletion/Core/_setup Completion/Core/_setup --- oldcompletion/Core/_setup Fri Dec 3 15:08:24 1999 +++ Completion/Core/_setup Fri Dec 3 15:29:39 1999 @@ -1,11 +1,13 @@ #autoload -local colors +local colors i -if _style -a "$1" list-colors colors; then - if [[ "$1" = default ]]; then - ZLS_COLORS="${(j.:.)${(@)colors:gs/:/\\\:}}" - else - eval "ZLS_COLORS=\"(${1})\${(j.:(${1}).)\${(@)colors:gs/:/\\\:}}:\${ZLS_COLORS}\"" +for i; do + if _style -a "$i" list-colors colors; then + if [[ "$1" = default ]]; then + ZLS_COLORS="${(j.:.)${(@)colors:gs/:/\\\:}}" + else + eval "ZLS_COLORS=\"(${i})\${(j.:(${i}).)\${(@)colors:gs/:/\\\:}}:\${ZLS_COLORS}\"" + fi fi -fi +done diff -u olddoc/Zsh/compsys.yo Doc/Zsh/compsys.yo --- olddoc/Zsh/compsys.yo Fri Dec 3 15:08:04 1999 +++ Doc/Zsh/compsys.yo Fri Dec 3 16:06:37 1999 @@ -523,10 +523,6 @@ instead are only used by some completion functions when looking up styles. -em(NOTE: There are far too many of them -- we have to find ways to reduce -the number. Please tell us if you think that you have identified a tag -that should be replaced by one of the more generic ones.) - startitem() item(tt(accounts))( used to look up the tt(users-hosts) style @@ -534,6 +530,10 @@ item(tt(all-files))( for the names of all files ) +item(tt(all-expansions))( +used by the tt(_expand) completer when adding the string containing +all expansions +) item(tt(arguments))( when an argument of a command may be completed ) @@ -561,6 +561,9 @@ for names of external commands and names of sub-commands (used by some commands like tt(cvs)) ) +item(tt(corrections))( +used by the tt(_approximate) completer for the possible corrections +) item(tt(cursors))( for cursor names used by X programs ) @@ -583,6 +586,9 @@ item(tt(displays))( for X display names ) +item(tt(expansions))( +used by the tt(_expand) completer for possible expansions +) item(tt(extensions))( for X server extensions ) @@ -661,6 +667,10 @@ ) item(tt(options))( for command options +) +item(tt(original))( +used by the tt(_approximate) and tt(_expand) completers when adding +the original string ) item(tt(other-accounts))( used to look up the tt(users-hosts) style -- Sven Wischnowsky wischnow@informatik.hu-berlin.de