1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 04:30:24 +02:00

make _dd not use already used specs; fix for selecting stuff to complete in _describe; fix for correction and _describe with grouped lists (15588)

This commit is contained in:
Sven Wischnowsky 2001-08-07 10:38:36 +00:00
parent 23581f7664
commit b0ac280e1a
4 changed files with 39 additions and 14 deletions

View file

@ -1,3 +1,11 @@
2001-08-07 Sven Wischnowsky <wischnow@zsh.org>
* 15588: Completion/Base/Completer/_approximate,
Completion/Base/Utility/_describe, Completion/Unix/Command/_dd:
make _dd not use already used specs; fix for selecting stuff to
complete in _describe; fix for correction and _describe with
grouped lists
2001-08-07 Peter Stephenson <pws@csr.com>
* 15586: Src/subst.c, Doc/Zsh/expn.yo: remove =alias expansion,

View file

@ -10,7 +10,7 @@
[[ _matcher_num -gt 1 || "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
local _comp_correct _correct_expl comax cfgacc match
local _comp_correct _correct_expl _correct_group comax cfgacc match
local oldcontext="${curcontext}" opm="$compstate[pattern_match]"
if [[ "$1" = -a* ]]; then
@ -58,6 +58,9 @@ if (( ! $+functions[compadd] )); then
# else
PREFIX="(#a${_comp_correct})$PREFIX"
# fi
(( $_correct_group )) && _correct_expl[_correct_group]=${argv[(R)-*[JV]]}
builtin compadd "$_correct_expl[@]" "$@"
}
trap 'unfunction compadd' EXIT INT
@ -73,6 +76,8 @@ while [[ _comp_correct -le comax ]]; do
_description corrections _correct_expl corrections \
"e:$_comp_correct" "o:$PREFIX$SUFFIX"
_correct_group="$_correct_expl[(I)-*[JV]]"
if _complete; then
if zstyle -t ":completion:${curcontext}:" insert-unambiguous &&
[[ "${#compstate[unambiguous]}" -ge "${#:-$PREFIX$SUFFIX}" ]]; then

View file

@ -78,9 +78,13 @@ while _tags; do
fi
if [[ -n $_mats ]]; then
compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -O $_strs -D $_mats -s $_strs
compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs - \
"${(@M)${(@P)_strs}##([^:\\]|\\?)##}"
compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_mats - \
"${(@M)${(@P)_strs}##([^:\\]|\\?)##}"
else
compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -O $_strs -a $_strs
compadd "$_opts[@]" "${(@)_expl:/-J/-2V}" -D $_strs - \
"${(@M)${(@P)_strs}##([^:\\]|\\?)##}"
fi
done
set - "$_argv[@]"

View file

@ -1,14 +1,22 @@
#compdef dd
_values -S '=' 'option' \
'if[specify input file]:input file:_tilde_files' \
'of[specify output file]:output file:_tilde_files' \
'ibs[input block size]:block size (bytes)' \
'obs[output block size]:block size (bytes)' \
'bs[block size]:block size (bytes)' \
'cbs[conversion buffer size]:buffer size (bytes)' \
'skip[input blocks initially skipped]:blocks' \
'seek[output blocks initially skipped]:blocks' \
'files[specify number of input files to copy and concatenate]:number of files' \
'count[number of input blocks to copy]:blocks' \
local opts
opts=(
'if[specify input file]:input file:_tilde_files'
'of[specify output file]:output file:_tilde_files'
'ibs[input block size]:block size (bytes)'
'obs[output block size]:block size (bytes)'
'bs[block size]:block size (bytes)'
'cbs[conversion buffer size]:buffer size (bytes)'
'skip[input blocks initially skipped]:blocks'
'seek[output blocks initially skipped]:blocks'
'files[specify number of input files to copy and concatenate]:number of files'
'count[number of input blocks to copy]:blocks'
'conv[specify conversions to apply]:conversion:_values -s , "conversion" ascii ebcdic ibm block unblock lcase ucase swab noerror sync'
)
[[ "$PREFIX$SUFFIX" != *\=* ]] &&
opts=( "${(@)opts:#(${(j:|:)~words[2,-1]%%\=*})\[*}" )
_values -S '=' 'option' "$opts[@]"