From eda0e496969f1eb06eec47501fce74f608d34704 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Wed, 22 Sep 1999 12:51:57 +0000 Subject: zsh-workers/7974 --- ChangeLog | 210 ----------------------------------------- Completion/Base/.distfiles | 7 +- Completion/Builtins/.distfiles | 4 +- Completion/Core/_multi_parts | 62 ++++-------- Completion/Core/_path_files | 35 ++----- Completion/Core/_sep_parts | 6 +- 6 files changed, 36 insertions(+), 288 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3fbd37855..3b54a2c65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,215 +1,5 @@ -1999-09-20 Peter Stephenson - - * pws: Config/version.mk: version 3.1.6-pws-5 - - * Sven: 7953: Completion/Commands/_expand_word, - Completion/Core/_expand, Doc/Zsh/compsys.yo: expand_completions - configuration key. - - * pws: 7952: Completion/X/_xutils: xrdb should complete file - arguments. - - * Sven: 7951: Src/subst.c, Doc/Zsh/expn.yo: parameter expansion flags - for quoting with single or double quotes. - - * Sven: 7950: Src/utils.c, Src/Zle/complist.c: more careful - with VARARR's. - - * Sven: 7949: 7949: Completion/X/_x_color, - Completion/X/_x_extension, Completion/X/_x_window, - Completion/X/_xutils: completion for standard X utilities. - - * pws: 7948: Src/glob.c, Src/pattern.c: indexes weren't - calculate properly in $mbegin, $mend, $MBEGIN, $MEND because - of Meta bytes. - - * Sven: 7947: Src/Zle/zle_tricky.c, Doc/Zsh/compwid.yo: - compstate[insert] can be all to insert all matches. - - * Sven: 7944: Src/Zle/zle_tricky.c, Completion/Core/_multi_parts, - Completion/Core/_path_files, Completion/Core/_sep_parts: - new heuristic for deciding whether to add strings under match - control or if they are too ambiguous to be useful. - - * Sven: 7943: Doc/Zsh/compsys.yo: docs for long args syntax - in _arguments. - - * Bart: zsh-users/2610: Completion/Builtins/_kill, - Completion/Builtins/_wait, Completion/User/_gdb: split words - for ps arguments (replaces 2609). - - * Bart: 7938: Completion/Base/_arg_compile, Completion/Base/_describe: - pre-compiler for _arguments and typo in describe. - - * Tanaka Akira: 7937: Completion/User/_cvs, Completion/User/_lynx, - Completion/User/_wget: it's good to have _values. - - * Bart: 7934: Completion/User/_telnet: improvement. - - * Bart: 7932: Completion/User/_mailboxes: more generic. - - * Bart: 7929: Src/hist.c, Src/Zle/zle_tricky.c: handle gaps - in history when scanning through it. - - * Bart: 7928: Doc/Zsh/builtins.yo: typo in float stuff. - - * Bart: 7925: Functions/Misc/run-help: various functions and - builtins in manual pages other than zshbuiltins. - - * Adam: 7923: Completion/Core/compinit: compconf quoting tweak. - -1999-09-17 Peter Stephenson - - * pws: 7921: Src/glob.c: bad test in rarely used - (string/)# globbing construct. - - * Oliver: 7919: Completion/User/_man: try to find a manpath if - none (slightly adapted). - - * Sven: 7917: Src/loop.c: hunk missed from 7915. - - * pws: 7915: Doc/Zsh/arith.yo, Doc/Zsh/builtins.yo, - Src/Modules/parameter.c, Src/builtin.c, Src/cond.c, Src/exec.c, - Src/math.c, Src/mem.c, Src/params.c, Src/subst.c, Src/zsh.h, - configure.in: Floating point support via typeset -F and - typeset -E for variables and in matheval(). mnumber struct - passes around float or integer. - - * Sven: 7903: Completion/Builtins/_cd: more careful with - things from cdablevars. - - * Sven: 7902, 7912: Completion/Base/_arguments, - Doc/Zsh/compsys.yo: autodescribe_options. - - * Sven: 7900: Completion/Commands/_history_complete_word, - Doc/Zsh/compsys.yo: history_stop config opt stops history - cycling past end. - - * Sven: 7896: Src/Zle/zle_tricky.c: cursor positioning. - - * Adam: 7892: Completion/User/_webbrowser: initial - implementation of completion for web browsers. - - * Adam: 7891: Completion/Core/compinit: error message in compdef. - - * Tanaka Akira: 7888: Completion/User/_wget: completion for wget. - - * Tanaka Akira; 7887: Completion/User/_telnet: try to get - valid telnet options. - - * Tanaka Akira: 7886: Completion/Base/_describe, - Completion/Debian/_apt, Completion/User/_cvs: -d option for - descriptions. - - * Adam: 7882: Doc/Zsh/expn.yo: parentheses. - -1999-09-16 Peter Stephenson - - * Adam: 7871: Completion/User/_perl_basepods, - Completion/User/_perl_builtin_funcs, - Completion/User/_perl_modules, Completion/User/_perldoc: - perl completion. - - * Sven: 7864: Src/Zle/zle_tricky.c: crash when browsing - directory hierarchies with select and selecting an entry. - - * Sven: 7863: Doc/Zsh/mod_parameter.yo, Src/Modules/parameter.c, - Src/Modules/parameter.mdd: $dirstack and $modules special - parameters. - - * Sven: 7866: Doc/Zsh/compsys.yo, Completion/User/_mutt: - action necessary. - - * Sven: 7862: Completion/Base/_arguments, Completion/User/_gcc, - Doc/Zsh/compsys.yo, Src/Zle/zle_tricky.c: completion for gcc, - -M match spec for _arguments, remove duplicate matches. - - * Clint: 7860: Completion/User/_mailboxes, Completion/User/_mutt: - mutt support. - -1999-09-15 Peter Stephenson - - * pws: 7855: Doc/Zsh/zftpsys.yo, Functions/Zftp/zfopen: - failed zfopen with arguments deletes the stored open parameters. - - * Oliver: 7852: Completion/Builtins/_compdef, - Completion/User/_man: new compdef support, _man works for whatis - and apropos. - - * Sven: 7850: Completion/Base/_arguments: minor cleanup. - - * Sven: 7844: Src/Zle/complist.c, Src/Zle/zle_tricky.c, - Doc/Zsh/compsys.yo, Etc/completion-style-guide, - Completion/Base/_arguments, Completion/Base/_describe, - Completion/Base/_subscript, Completion/Base/_tilde, - Completion/Base/_values, Completion/Builtins/_cd, - Completion/Builtins/_kill, Completion/Builtins/_wait, - Completion/Core/_approximate, Completion/Core/_expand, - Completion/User/_gdb: various matching display bugs - (with compadd -d) and enhancements to correction and - approximation keys. - - * Tanaka Akira: 7840: Completion/Base/_tilde, - Completion/Builtins/_cd: use compadd -d. - - * pws: 7836: Src/Modules/zftp.c: bug from 7767: zftp rmsession - incremented node pointer wrongly and assigned new session - wrongly. - - * pws: 7834: Src/pattern.c: bug from 7825, pure string path - segments wouldn't approximate. - -1999-09-14 Peter Stephenson - - * Sven: 7827: Src/Zle/comp.h, Src/Zle/compctl.c, - Src/Zle/complist.c, Src/Zle/zle_tricky.c, Doc/Zsh/compsys.yo, - Doc/Zsh/compwid.yo, Completion/Base/_arguments, - Completion/Base/_values, Completion/Core/_display, - Completion/User/_mount: compadd -d for list of elements - to display instead of matches, -l to show one per line, - plus changes in _display and uses thereof; typos in _mount. - - * pws: 7825, 7848: Doc/Zsh/expn.yo, Src/glob.c, Src/pattern.c, - Src/subst.c, Src/zsh.h: (#b) and (#m) globbing flags and - inverses; speed up compilation of pure string patterns. - - * Sven: 7823: Src/Zle/zle_tricky.c: improve joining of completion - strings with different match control behaviour. - - * Sven: 7824: Completion/Base/_arguments, Completion/Core/_message: - improve `no more arguments' message. - - * Sven: 7819: Completion/Base/_arguments, Doc/Zsh/compsys.yo: - use of $options for single character options. - - * Tanaka Akira: 7817: Completion/Debian/_apt, - Completion/User/_socket, Completion/User/_perl_builtin_funcs: - several improvements. - - * Tanaka Akira: 7815: Completion/User/_combination, - Completion/User/_ports, Completion/User/_socket, - Completion/User/_telnet: more sophisticated port/user - combinations via general combination mechanism. - - * Bart: 7813: Src/subst.c: correct incorrect application of - correction in 7697. - - * Tanaka Akira: 7740: Completion/User/_man: handle gzipped and - SGML manual pages. - 1999-09-13 Peter Stephenson - * pws: zsh-users/2598: Functions/Zle/incarg: zle function to - increment number under cursor. - - * pws: 7812: Completion/X/_xrdb: now exists. - - * Tanaka Akira: 7809: Completion/Debian/_apt, Completion/User/_patch: - new apt options and typo in _patch. - - * Sven: 7808: Completion/Base/_arguments: don't add long options - sometimes. - * pws: Config/version.mk: 3.1.6-pws-4. * Tanaka Akira: 7806: Completion/Users/_pbm: missing backslash. 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[@]" -- cgit 1.4.1