1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-25 17:41:19 +02:00

zsh-workers/7959

This commit is contained in:
Tanaka Akira 1999-09-22 12:53:49 +00:00
parent eda0e49696
commit c17448c276
8 changed files with 320 additions and 45 deletions

210
ChangeLog
View file

@ -1,5 +1,215 @@
1999-09-20 Peter Stephenson <pws@ibmth.df.unipi.it>
* 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@ibmth.df.unipi.it>
* 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 <pws@ibmth.df.unipi.it>
* 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@ibmth.df.unipi.it>
* 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 <pws@ibmth.df.unipi.it>
* 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@ibmth.df.unipi.it>
* 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.

View file

@ -1,7 +1,6 @@
DISTFILES_SRC='
.distfiles
_arguments _brace_parameter _command_names
_condition _default _equal _first
_math _parameter _precommand _redirect _regex_arguments _subscript
_tilde _values _vars
_arg_compile _arguments _brace_parameter _command_names _condition
_default _describe _equal _first _math _parameter _precommand _redirect
_regex_arguments _subscript _tilde _values _vars
'

View file

@ -1,7 +1,7 @@
DISTFILES_SRC='
.distfiles
_aliases _arrays _autoload _bg_jobs _bindkey _builtin _cd _command
_dirs _disable _echotc _enable _fc _functions _hash _jobs _kill
_compdef _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
'

View file

@ -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
local sep matches pref npref i tmp1 group expl menu pre suf opre osuf cpre
typeset -U tmp2
# Get the options.
@ -40,6 +40,8 @@ fi
pre="$PREFIX"
suf="$SUFFIX"
opre="$PREFIX"
osuf="$SUFFIX"
orig="$PREFIX$SUFFIX"
# Special handling for menucompletion?
@ -100,14 +102,17 @@ while true; do
matches=( "${(@M)matches:#${tmp1[1]}*}" )
tmp2=( "${(@M)matches:#${tmp1[1]}${sep}*}" )
PREFIX="${cpre}${pre}"
SUFFIX="$suf"
if (( $#tmp2 )); then
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-p "$pref" -qS "$sep" - "$tmp1[1]"
compadd "$group[@]" "$expl[@]" -p "$pref" -qS "$sep" \
-M "r:|${sep}=* r:|=*" - "$tmp1[1]"
else
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-p "$pref" - "$tmp1[1]"
compadd "$group[@]" "$expl[@]" -p "$pref" \
-M "r:|${sep}=* r:|=*" - "$tmp1[1]"
fi
return 1
return 0
fi
elif (( $#tmp1 )); then
@ -118,6 +123,14 @@ 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
@ -125,11 +138,12 @@ while true; do
tmp2="$pre$suf"
if [[ "$tmp2" = *${sep}* ]]; then
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-p "$pref" -s "${sep}${tmp2#*${sep}}" - "$tmp1[@]"
compadd "$group[@]" "$expl[@]" \
-p "$pref" -s "${sep}${tmp2#*${sep}}" \
-M "r:|${sep}=* r:|=*" - "$tmp1[@]"
else
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-p "$pref" - "$tmp1[@]"
compadd "$group[@]" "$expl[@]" -p "$pref"\
-M "r:|${sep}=* r:|=*" - "$tmp1[@]"
fi
else
# With normal completion we add all matches one-by-one with
@ -138,11 +152,12 @@ while true; do
for i in "${(@M)matches:#(${(j:|:)~tmp1})*}"; do
if [[ "$i" = *${sep}* ]]; then
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-S '' -p "$pref" -s "${i#*${sep}}" - "${i%%${sep}*}${sep}"
compadd "$group[@]" "$expl[@]" -S '' \
-p "$pref" -s "${i#*${sep}}" \
-M "r:|${sep}=* r:|=*" - "${i%%${sep}*}${sep}"
else
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-S '' -p "$pref" - "$i"
compadd "$group[@]" "$expl[@]" -S '' -p "$pref" \
-M "r:|${sep}=* r:|=*" - "$i"
fi
done
fi
@ -154,12 +169,15 @@ while true; do
[[ "$orig" = "$pref$pre$suf" ]] && return 1
PREFIX="${cpre}${pre}"
SUFFIX="$suf"
if [[ -n "$suf" ]]; then
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-s "$suf" - "$pref$pre"
compadd "$group[@]" "$expl[@]" -s "$suf" \
-M "r:|${sep}=* r:|=*" - "$pref$pre"
else
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-S '' - "$pref$pre$suf"
compadd "$group[@]" "$expl[@]" -S '' \
-M "r:|${sep}=* r:|=*" - "$pref$pre"
fi
return 0
fi
@ -175,8 +193,10 @@ 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
@ -184,9 +204,11 @@ while true; do
# unambiguous prefix and that differs from the original string,
# we insert it.
PREFIX="${opre}${osuf}"
SUFFIX=""
[[ -n "$pref" && "$orig" != "$pref" ]] &&
compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
-S '' - "$pref"
compadd "$group[@]" "$expl[@]" -S '' -M "r:|${sep}=* r:|=*" - "$pref"
return
fi

View file

@ -24,7 +24,7 @@
# menucompletion.
local linepath realpath donepath prepath testpath exppath
local tmp1 tmp2 tmp3 tmp4 i orig pre suf tpre tsuf
local tmp1 tmp2 tmp3 tmp4 i orig pre suf tpre tsuf opre osuf cpre
local pats haspats=no ignore group expl addpfx addsfx remsfx
local nm=$compstate[nmatches] menu
@ -118,6 +118,8 @@ fi
pre="$PREFIX"
suf="$SUFFIX"
opre="$PREFIX"
osuf="$SUFFIX"
orig="${PREFIX}${SUFFIX}"
[[ $compstate[insert] = (*menu|[0-9]*) || -n "$_comp_correct" ||
@ -291,6 +293,8 @@ 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
@ -349,35 +353,43 @@ 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#*/}" \
compadd -Qf -p "$linepath${testpath:q}" -s "/${tmp3#*/}" \
-W "$prepath$realpath$testpath" "$ignore[@]" \
"$addpfx[@]" "$addsfx[@]" "$remsfx[@]" -M 'r:|/=* r:|=*' \
"$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
"$group[@]" "$expl[@]" \
- "${(@)${(@)tmp1%%/*}:q}"
else
compadd -QUf -p "$linepath${testpath:q}" \
compadd -Qf -p "$linepath${testpath:q}" \
-W "$prepath$realpath$testpath" "$ignore[@]" \
"$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \
"$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
"$addpfx[@]" "$addsfx[@]" "$remsfx[@]" -M 'r:|/=* r:|=*' \
"$group[@]" "$expl[@]" \
- "${(@)tmp1:q}"
fi
else
if [[ "$tmp3" = */* ]]; then
for i in "$tmp1[@]"; do
compadd -QUf -p "$linepath${testpath:q}" -s "/${${i#*/}:q}" \
compadd -Qf -p "$linepath${testpath:q}" -s "/${${i#*/}:q}" \
-W "$prepath$realpath$testpath" "$ignore[@]" \
"$addpfx[@]" "$addsfx[@]" "$remsfx[@]" -M 'r:|/=* r:|=*' \
"$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
"$group[@]" "$expl[@]" \
- "${${i%%/*}:q}"
done
else
compadd -QUf -p "$linepath${testpath:q}" \
compadd -Qf -p "$linepath${testpath:q}" \
-W "$prepath$realpath$testpath" "$ignore[@]" \
"$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \
"$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
"$addpfx[@]" "$addsfx[@]" "$remsfx[@]" -M 'r:|/=* r:|=*' \
"$group[@]" "$expl[@]" \
- "${(@)tmp1:q}"
fi
fi
@ -399,14 +411,17 @@ for prepath in "$prepaths[@]"; do
testpath="${testpath}${tmp1[1]%%/*}/"
tmp1=( "${(@)tmp1#*/}" )
cpre="${cpre}${tmp3%%/*}/"
tmp3="${tmp3#*/}"
done
if [[ -z "$tmp4" ]]; then
compadd -QUf -p "$linepath${testpath:q}" \
PREFIX="${opre}${osuf}"
SUFFIX=""
compadd -Qf -p "$linepath${testpath:q}" \
-W "$prepath$realpath$testpath" "$ignore[@]" \
"$addpfx[@]" "$addsfx[@]" "$remsfx[@]" \
"$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
"$addpfx[@]" "$addsfx[@]" "$remsfx[@]" -M 'r:|/=* r:|=*' \
"$group[@]" "$expl[@]" \
- "${(@)tmp1:q}"
fi
done
@ -419,7 +434,9 @@ exppaths=( "${(@)exppaths:#$orig}" )
if [[ -n "$compconfig[path_expand]" &&
$#exppaths -gt 0 && nm -eq compstate[nmatches] ]]; then
compadd -QU -S '' "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \
PREFIX="${opre}${osuf}"
SUFFIX=""
compadd -Q -S '' "$group[@]" "$expl[@]" \
-M 'r:|/=* r:|=*' -p "$linepath" - "$exppaths[@]"
fi

View file

@ -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]
local matchflags opt group expl nm=$compstate[nmatches] opre osuf
# Get the options.
@ -34,6 +34,8 @@ shift OPTIND-1
# Get the string from the line.
opre="$PREFIX"
osuf="$SUFFIX"
str="$PREFIX$SUFFIX"
SUFFIX=""
prefix=""
@ -144,6 +146,8 @@ 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[@]"

View file

@ -1153,6 +1153,29 @@ An array holding the names of the groups that should be completed. If
this is not set by the user, it will automatically be set to a list
of group names taken from the YP database or the file `tt(/etc/group)'.
)
item(tt(hosts))(
An array holding the names of hosts that should be completed. If this
is not set by the user it will automatically be set to a list of the
hostnames in `tt(/etc/hosts)'.
)
item(tt(ports))(
An array holding the service names of ports to complete. If this is
not set by the user, it will be set to a list of the service names
from `tt(/etc/services)'.
)
item(tt(telnet_hosts_ports_users))(
This array is used by the completion function for tt(telnet). It
should contain elements of the form
`var(host)tt(:)var(port)tt(:)var(user)'. These triples will be used to
complete names of hosts, ports, and usernames depending on the
information already on the line, so that if, for example, the hostname
is already typed, only those ports and usernames will be completed for
which triples with the hostname from the line exist.
)
item(tt(socket_hosts_ports))(
Like tt(telnet_hosts_ports_users), but used for the tt(socket) command
and containing pairs of hostnames and ports.
)
enditem()
subsect(Configuration keys)

View file

@ -1181,13 +1181,13 @@ bin_zmodload(char *nam, char **args, char *ops, int func)
nicezputs((char *) getdata(node), stdout);
putchar('\n');
}
return 0;
} else {
for (; *args; args++)
for (node = firstnode(bltinmodules); node; incnode(node))
if (strcmp(*args, (char *) getdata(node)))
return 1;
if (!strcmp(*args, (char *) getdata(node)))
return 0;
}
return 0;
}
/* Otherwise we return 1 -- different from the dynamic version. */
return 1;