1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-01 21:51:40 +02:00

make _guard use _mesage -e'; make _message -e' use $curtag as a default; change uses of _guard (16708)

This commit is contained in:
Sven Wischnowsky 2002-02-25 09:09:31 +00:00
parent 5b34b8ddba
commit 8dcd8e54c5
9 changed files with 34 additions and 32 deletions

View file

@ -1,3 +1,12 @@
2002-02-25 Sven Wischnowsky <wischnow@zsh.org>
* 16708: Completion/Base/Core/_message,
Completion/Base/Utility/_guard, Completion/Unix/Command/_grep,
Completion/Unix/Command/_pbm, Completion/Unix/Command/_pine,
Completion/X/Command/_vnc, Doc/Zsh/compsys.yo,
Src/Zle/compcore.c: make _guard use `_mesage -e'; make
`_message -e' use $curtag as a default; change uses of _guard
2002-02-22 Wayne Davison <wayned@users.sourceforge.net>
* 16703: Src/hist.c: In putoldhistentryontop(), ensure that we can't

View file

@ -3,11 +3,17 @@
local format raw gopt
if [[ "$1" = -e ]]; then
local expl ret=1
local expl ret=1 tag
_comp_mesg=yes
_tags "$2" && while _next_label "$2" expl "$3"; do
if (( $# > 2 )); then
tag="$2"
shift
else
tag="$curtag"
fi
_tags "$tag" && while _next_label "$tag" expl "$2"; do
compadd ${expl:/-X/-x}
ret=0
done

View file

@ -1,17 +1,12 @@
#autoload
local mesg pat garbage
local garbage
mesg=()
zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:=mesg
zparseopts -K -D -a garbage M: J: V: 1 2 n F: X:
[[ "$PREFIX$SUFFIX" != $~1 ]] && return 1
if [[ $# -gt 1 || $#mesg -eq 0 ]]; then
shift
_message "$*"
else
_message -r "$mesg[2]"
fi
shift
_message -e "$*"
[[ -n "$PREFIX$SUFFIX" ]]

View file

@ -51,7 +51,7 @@ arguments=( $arguments[@]
'(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after FILE name]'
'--help[display help]'
'--mmap[memory map input]'
'(-e --regexp -f --file)1:pattern:_guard "^--*"'
'(-e --regexp -f --file)1: :_guard "^--*" pattern'
'*:files:_files'
)

View file

@ -398,7 +398,7 @@ pnmpad)
'-l-[specify left border width]:left border width:' \
'-r-[specify right border width]:right border width:' \
'-t-[specify top border width]:top border width:' \
'-b-[specify bottom border width]:bottom border width:_guard "[0-9]#"' \
'-b-[specify bottom border width]: :_guard "[0-9]#" "bottom border width"' \
':file: _pbm'
;;

View file

@ -34,11 +34,11 @@ _arguments -C -s \
"($opts $idx -url)-attach_and_delete[go to composer, attach file, delete when finished]:file:_files" \
"($opts $idx $send)-url[open the given URL]:url:->url" \
"($opts $send)-f+[specify mailbox to load]:mailbox: _mailboxes" \
"($opts $send)-c+[specify context to apply to -f arg]:number:_guard '[0-9]#'" \
"($opts $send)-c+[specify context to apply to -f arg]: :_guard '[0-9]#' number" \
"($opts $send)-sort[specify sort order of folder]:sort order:(${(j: :)sortorder})" \
"($opts $send)-i[go directly to index, bypassing main menu]" \
"($opts $send)-I+[specify initial keystrokes to be executed]:keystrokes" \
"($opts $send)-n+[entry in index to begin on]:number:_guard '[0-9]#'" \
"($opts $send)-n+[entry in index to begin on]: :_guard '[0-9]#' number" \
"($opts $send)-o[open first folder read-only]" \
"(-F -h -v)-r[restricted - can only send mail to oneself]" \
"(-h -v)-d[set debug level]:debug:(0 1 2 3 4 5 6 7 8 9 flush timestamp imap= numfiles= verbose=)" \

View file

@ -13,7 +13,7 @@ case $service in
'-geometry:geometry:(1600x1200 1280x1024 1152x864 1024x768 800x600 640x480)' \
'-depth:pixel depth:(8 16 24 32)' \
'-pixelformat:pixel format' \
'1::display number:_guard "(|:[0-9]#)"' \
'1:: :_guard "(|:[0-9]#)" "display number"' \
- kill \
"-kill:display number:($displays)" \
- help \

View file

@ -3673,7 +3673,7 @@ command has to be called and hence it shouldn't be used if one can't
be sure that the command understands the `tt(-)tt(-help)' option.
)
findex(_guard)
item(tt(_guard) [ var(options) ] var(pattern) [ var(descr) ])(
item(tt(_guard) [ var(options) ] var(pattern descr))(
This function is intended to be used in an action of functions like
tt(_arguments). It returns immediately with a non-zero return value if
the string to be completed does not match the var(pattern). If the
@ -3683,18 +3683,11 @@ zero if the word to complete is not empty and non-zero otherwise.
The var(pattern) may be preceded by those options understood by
tt(compadd) that are passed down from tt(_description), namely tt(-M),
tt(-J), tt(-V), tt(-1), tt(-2), tt(-n), tt(-F) and tt(-X). All of these
options, except tt(-X), will be ignored. If the tt(-X) option appears,
the description following it will be used as the string to display if
the var(pattern) matches, unless the option var(descr) is given to
tt(_guard) itself, which will then take precedence.
options will be ignored.
As an example, consider a command taking the options tt(-n) and
tt(-none), where tt(-n) has to be followed by a numeric value in the
same word. By using either of:
example(_argument '-n-:numeric value:_guard "[0-9]#"' '-none')
or
same word. By using:
example(_argument '-n-: :_guard "[0-9]#" "numeric value"' '-none')
@ -3706,7 +3699,7 @@ followed by another character, only options are completed.
)
findex(_message)
xitem(tt(_message) [ tt(-r12) ] [ tt(-VJ) var(group) ] var(descr))
item(tt(_message -e) var(tag descr))(
item(tt(_message -e) [ var(tag) ] var(descr))(
The var(descr) is used like the third
argument to the tt(_description) function. However, the resulting
string will always be shown whether or not matches were
@ -3727,7 +3720,10 @@ hence determine the group the message string is added to.
In the second form, the var(descr) is added like a description added
by tt(_description) under the given var(tag), but the var(descr) will
always be shown even if no matches are added for the var(tag).
always be shown even if no matches are added for the var(tag). If the
var(tag) is omitted, it is taken from the tt(curtag) parameter which
is set by the functions dealing with tags so it should contain the
right one in almost all cases.
)
findex(_multi_parts)
item(tt(_multi_parts) var(sep) var(array))(

View file

@ -1648,10 +1648,6 @@ addmatches(Cadata dat, char **argv)
if (!*argv && !dat->dummies && !(dat->aflags & CAF_ALL))
return 1;
#if 0
if (dat->dummies)
dat->aflags = (dat->aflags | CAF_NOSORT | CAF_UNIQCON) & ~CAF_UNIQALL;
#endif
for (bp = brbeg; bp; bp = bp->next)
bp->curpos = ((dat->aflags & CAF_QUOTE) ? bp->pos : bp->qpos);
for (bp = brend; bp; bp = bp->next)