mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-19 11:31:26 +01:00
another fix for 15477 (separator strings); add list-separator style (15484)
This commit is contained in:
parent
e1708022d2
commit
c83d16f8ee
9 changed files with 41 additions and 16 deletions
|
@ -1,5 +1,13 @@
|
|||
2001-07-25 Sven Wischnowsky <wischnow@zsh.org>
|
||||
|
||||
* 15484: Completion/AIX/Command/_lscfg,
|
||||
Completion/AIX/Type/_logical_volumes,
|
||||
Completion/Base/Utility/_describe,
|
||||
Completion/Unix/Type/_printers, Completion/Zsh/Command/_zstyle,
|
||||
Completion/Zsh/Context/_subscript, Doc/Zsh/compsys.yo,
|
||||
Src/Zle/computil.c: another fix for 15477 (separator strings);
|
||||
add list-separator style
|
||||
|
||||
* 15482: Doc/Zsh/compwid.yo, Src/Zle/compcore.c,
|
||||
Src/Zle/computil.c: fixlet for 15477, don't let it remove
|
||||
consecutive dummy matches
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#compdef lscfg
|
||||
|
||||
local state line expl curcontext="$curcontext" disp list devs
|
||||
local state line expl curcontext="$curcontext" disp list devs sep
|
||||
|
||||
_arguments -C -s \
|
||||
'-l[display device information for named device]:device:->device' \
|
||||
|
@ -9,7 +9,8 @@ _arguments -C -s \
|
|||
if [[ "$state" = device ]]; then
|
||||
devs=( ${${${${(f)"$(lscfg)"}[6,-1]:# *}##??}/ ##[^ ]# #/:} )
|
||||
if zstyle -T ":completion:${curcontext}:devices" verbose; then
|
||||
zformat -a list ' -- ' "$devs[@]"
|
||||
zstyle -s ":completion:${curcontext}:devices" list-separator sep || sep=--
|
||||
zformat -a list " $sep " "$devs[@]"
|
||||
disp=(-ld list)
|
||||
else
|
||||
disp=()
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#autoload
|
||||
|
||||
local expl list names disp
|
||||
local expl list names disp sep
|
||||
|
||||
list=( $(lsvg -l $(lsvg)|sed -e '2d'|awk '/[^:]* / {if ( $7 != "N/A" ) print $1 ":" $7; else print $1}' ) )
|
||||
names=(${list%%:*})
|
||||
if zstyle -T ":completion:${curcontext}" verbose; then
|
||||
zformat -a list ' -- ' $list
|
||||
if zstyle -T ":completion:${curcontext}:" verbose; then
|
||||
zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
|
||||
zformat -a list " $sep " $list
|
||||
disp=(-d list)
|
||||
else
|
||||
disp=()
|
||||
|
|
|
@ -23,12 +23,13 @@ fi
|
|||
|
||||
zstyle -T ":completion:${curcontext}:$_type" verbose && _showd=yes
|
||||
|
||||
zstyle -s ":completion:${curcontext}:$_type" list-separator _sep || _sep=--
|
||||
|
||||
if zstyle -T ":completion:${curcontext}:$_type" list-grouped; then
|
||||
local _argv _new _strs _mats _opts _i=2
|
||||
|
||||
_argv=( "$@" )
|
||||
_grp=(-g)
|
||||
_sep='-- '
|
||||
_new=( "$1" )
|
||||
shift
|
||||
|
||||
|
@ -68,7 +69,6 @@ if zstyle -T ":completion:${curcontext}:$_type" list-grouped; then
|
|||
set - "$_argv[@]"
|
||||
else
|
||||
_grp=()
|
||||
_sep=' -- '
|
||||
fi
|
||||
|
||||
_descr="$1"
|
||||
|
@ -83,7 +83,7 @@ while _tags; do
|
|||
while _next_label "$_type" _expl "$_descr"; do
|
||||
|
||||
if [[ -n "$_showd" ]]; then
|
||||
compdescribe -I "$_hide" "$_sep" _expl "$_grp[@]" "$@"
|
||||
compdescribe -I "$_hide" "$_sep " _expl "$_grp[@]" "$@"
|
||||
else
|
||||
compdescribe -i "$_hide" "$@"
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#autoload
|
||||
|
||||
local expl ret=1 list disp
|
||||
local expl ret=1 list disp sep
|
||||
|
||||
if (( $+commands[lsallq] )); then
|
||||
# Use AIX's command to list print queues
|
||||
|
@ -8,6 +8,8 @@ if (( $+commands[lsallq] )); then
|
|||
return
|
||||
fi
|
||||
|
||||
zstyle -s ":completion:${curcontext}:printers" list-separator sep || sep=--
|
||||
|
||||
if (( ! $+_lp_cache )); then
|
||||
local file entry names i
|
||||
|
||||
|
@ -42,7 +44,7 @@ if (( ! $+_lp_cache )); then
|
|||
fi
|
||||
|
||||
if zstyle -T ":completion:${curcontext}:printers" verbose; then
|
||||
zformat -a list ' -- ' "$_lp_cache[@]"
|
||||
zformat -a list " $sep " "$_lp_cache[@]"
|
||||
disp=(-ld list)
|
||||
else
|
||||
disp=()
|
||||
|
@ -53,7 +55,7 @@ _wanted printers expl printer \
|
|||
(( $+_lp_alias_cache )) || return 1
|
||||
|
||||
if zstyle -T ":completion:${curcontext}:printers" verbose; then
|
||||
zformat -a list ' -- ' "$_lp_alias_cache[@]"
|
||||
zformat -a list " $sep " "$_lp_alias_cache[@]"
|
||||
disp=(-ld list)
|
||||
else
|
||||
disp=()
|
||||
|
|
|
@ -59,6 +59,7 @@ styles=(
|
|||
list-packed c:bool
|
||||
list-prompt c:
|
||||
list-rows-first c:bool
|
||||
list-separator c:separator
|
||||
list-suffixes c:bool
|
||||
local c:
|
||||
match-original c:match-orig
|
||||
|
@ -310,6 +311,10 @@ while [[ -n $state ]]; do
|
|||
_message 'pattern matching prefix to keep'
|
||||
;;
|
||||
|
||||
separator)
|
||||
_message 'separator string'
|
||||
;;
|
||||
|
||||
urgh)
|
||||
_wanted values expl no compadd no false off 0
|
||||
;;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#compdef -subscript-
|
||||
|
||||
local expl ind osuf=']' flags
|
||||
local expl ind osuf=']' flags sep
|
||||
|
||||
if [[ "$1" = -q ]]; then
|
||||
osuf='] '
|
||||
|
@ -91,7 +91,8 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
|
|||
list=( "$list[@]" '' )
|
||||
fi
|
||||
done
|
||||
zformat -a list ' -- ' "$list[@]"
|
||||
zstyle -s ":completion:${curcontext}:indexes" list-separator sep || sep=--
|
||||
zformat -a list " $sep " "$list[@]"
|
||||
disp=( -d list)
|
||||
else
|
||||
disp=()
|
||||
|
|
|
@ -1563,6 +1563,12 @@ typed pathname components and this style is set to `true', all
|
|||
components starting with the first one for which more than one match
|
||||
could be generated will be shown.
|
||||
)
|
||||
kindex(list-separator, completion style)
|
||||
item(tt(list-separator))(
|
||||
The value of this style is used in completion listing to separate the
|
||||
string to complete from a description when possible (e.g. when
|
||||
completing options). It defaults to `tt(-)tt(-)' (two hyphens).
|
||||
)
|
||||
kindex(local, completion style)
|
||||
item(tt(local))(
|
||||
This style is used by completion functions which generate URLs as
|
||||
|
|
|
@ -504,11 +504,12 @@ cd_get(char **params)
|
|||
case CRT_DESC:
|
||||
{
|
||||
VARARR(char, buf,
|
||||
cd_state.pre + cd_state.suf + cd_state.slen + 1);
|
||||
cd_state.pre + cd_state.suf + cd_state.slen + 3);
|
||||
char *sufp = NULL;
|
||||
|
||||
memcpy(buf + cd_state.pre, cd_state.sep, cd_state.slen);
|
||||
sufp = buf + cd_state.pre + cd_state.slen;
|
||||
memcpy(buf + cd_state.pre + 2, cd_state.sep, cd_state.slen);
|
||||
buf[cd_state.pre] = buf[cd_state.pre + 1] = ' ';
|
||||
sufp = buf + cd_state.pre + cd_state.slen + 2;
|
||||
|
||||
mats = mp = (char **) zalloc((run->count + 1) * sizeof(char *));
|
||||
dpys = dp = (char **) zalloc((run->count + 1) * sizeof(char *));
|
||||
|
|
Loading…
Reference in a new issue