From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: PATCH: Re: 4.0.1 - arguments test fails
Date: Wed, 6 Jun 2001 11:21:19 +0200 (MET DST) [thread overview]
Message-ID: <200106060921.LAA23449@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: <3B181725.8000008@mow.siemens.ru>
Andrej Borsenkow wrote:
> /tools/src/zsh-4.0.x/Test/Y03arguments.ztst: starting.
> *** /tmp/zsh.ztst.out.959 Sat Jun 2 02:25:33 2001
> --- /tmp/zsh.ztst.tout.959 Sat Jun 2 02:25:33 2001
> ***************
> *** 1,4 ****
> line: {tst -}{}
> MESSAGE:{arg}
> - DESCRIPTION:{option}
> - NO:{-x}
> --- 1,2 ----
> Test /tools/src/zsh-4.0.x/Test/Y03arguments.ztst failed: output differs
> from expected as shown above for:
> tst_arguments '-x' ':arg:'
> comptest $'tst -\t'
> Was testing: argument beginning with minus
> /tools/src/zsh-4.0.x/Test/Y03arguments.ztst: test failed.
> gmake[1]: [check] Error 1 (ignored)
> rm -rf Modules .zcompdump
> gmake[1]: Leaving directory `/u3/u1/build/zsh-4.0.x/Test'
Oh boy, am I ashamed.
The patch makes the test suite happy again and also fixes Peter's
problem with history/fc. It looks big, but that's mostly re-indentation.
There were basically two problems: in the test suite, my bad patch kept
multiple actions from being tried -- the test to keep it from trying the
same action more than once was placed wrongly -- and if we haven't an
option on the command line, we should try to complete options, even if
we've already tried an action.
Oh boy, am I ashamed.
I'm going to commit this now, do I have to commit it somewhere else, too
(because of branching or something)?
I'm soo ashamed. I'll better creep back into my hole in the ground now...
Bye
Sven
Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.7
diff -u -r1.7 _arguments
--- Completion/Base/Utility/_arguments 2001/06/01 14:29:11 1.7
+++ Completion/Base/Utility/_arguments 2001/06/06 09:17:26
@@ -186,6 +186,8 @@
esac
done
+[[ "$PREFIX" = [-+] ]] && alwopt=arg
+
zstyle -s ":completion:${curcontext}:options" auto-description autod
if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
@@ -227,106 +229,108 @@
while true; do
while _tags; do
anum=1
- while [[ anum -le $#descrs ]]; do
-
- action="$actions[anum]"
- descr="$descrs[anum]"
- subc="$subcs[anum++]"
+ if [[ -z "$tried" ]]; then
+ while [[ anum -le $#descrs ]]; do
- if [[ -z "$tried" ]] && { [[ -n "$matched" ]] || _requested "$subc" }; then
+ action="$actions[anum]"
+ descr="$descrs[anum]"
+ subc="$subcs[anum++]"
- curcontext="${oldcontext%:*}:$subc"
+ if [[ -n "$matched" ]] || _requested "$subc"; then
- _description "$subc" expl "$descr"
+ curcontext="${oldcontext%:*}:$subc"
- if [[ "$action" = \=\ * ]]; then
- action="$action[3,-1]"
- words=( "$subc" "$words[@]" )
- (( CURRENT++ ))
- fi
+ _description "$subc" expl "$descr"
- if [[ "$action" = -\>* ]]; then
- action="${${action[3,-1]##[ ]#}%%[ ]#}"
- if (( ! $state[(I)$action] )); then
- comparguments -W line opt_args
- state=( "$state[@]" "$action" )
- if [[ -n "$usecc" ]]; then
- curcontext="${oldcontext%:*}:$subc"
- else
- context=( "$context[@]" "$subc" )
- fi
- compstate[restore]=''
- aret=yes
+ if [[ "$action" = \=\ * ]]; then
+ action="$action[3,-1]"
+ words=( "$subc" "$words[@]" )
+ (( CURRENT++ ))
fi
- else
- if [[ -z "$local" ]]; then
- local line
- typeset -A opt_args
- local=yes
- fi
- comparguments -W line opt_args
+ if [[ "$action" = -\>* ]]; then
+ action="${${action[3,-1]##[ ]#}%%[ ]#}"
+ if (( ! $state[(I)$action] )); then
+ comparguments -W line opt_args
+ state=( "$state[@]" "$action" )
+ if [[ -n "$usecc" ]]; then
+ curcontext="${oldcontext%:*}:$subc"
+ else
+ context=( "$context[@]" "$subc" )
+ fi
+ compstate[restore]=''
+ aret=yes
+ fi
+ else
+ if [[ -z "$local" ]]; then
+ local line
+ typeset -A opt_args
+ local=yes
+ fi
- if [[ "$action" = \ # ]]; then
+ comparguments -W line opt_args
- # An empty action means that we should just display a message.
+ if [[ "$action" = \ # ]]; then
- _message "$descr"
- mesg=yes
- tried=yes
+ # An empty action means that we should just display a message.
- elif [[ "$action" = \(\(*\)\) ]]; then
+ _message "$descr"
+ mesg=yes
+ tried=yes
+ alwopt=${alwopt:-yes}
+ elif [[ "$action" = \(\(*\)\) ]]; then
- # ((...)) contains literal strings with descriptions.
+ # ((...)) contains literal strings with descriptions.
- eval ws\=\( "${action[3,-3]}" \)
+ eval ws\=\( "${action[3,-3]}" \)
- _describe -t "$subc" "$descr" ws -M "$matcher" "$subopts[@]" ||
- alwopt=${alwopt:-yes}
- tried=yes
+ _describe -t "$subc" "$descr" ws -M "$matcher" "$subopts[@]" ||
+ alwopt=${alwopt:-yes}
+ tried=yes
- elif [[ "$action" = \(*\) ]]; then
+ elif [[ "$action" = \(*\) ]]; then
- # Anything inside `(...)' is added directly.
+ # Anything inside `(...)' is added directly.
- eval ws\=\( "${action[2,-2]}" \)
+ eval ws\=\( "${action[2,-2]}" \)
- _all_labels "$subc" expl "$descr" compadd "$subopts[@]" -a - ws ||
- alwopt=${alwopt:-yes}
- tried=yes
- elif [[ "$action" = \{*\} ]]; then
+ _all_labels "$subc" expl "$descr" compadd "$subopts[@]" -a - ws ||
+ alwopt=${alwopt:-yes}
+ tried=yes
+ elif [[ "$action" = \{*\} ]]; then
- # A string in braces is evaluated.
+ # A string in braces is evaluated.
- while _next_label "$subc" expl "$descr"; do
- eval "$action[2,-2]" && ret=0
- done
- (( ret )) && alwopt=${alwopt:-yes}
- tried=yes
- elif [[ "$action" = \ * ]]; then
+ while _next_label "$subc" expl "$descr"; do
+ eval "$action[2,-2]" && ret=0
+ done
+ (( ret )) && alwopt=${alwopt:-yes}
+ tried=yes
+ elif [[ "$action" = \ * ]]; then
- # If the action starts with a space, we just call it.
+ # If the action starts with a space, we just call it.
- eval "action=( $action )"
- while _next_label "$subc" expl "$descr"; do
- "$action[@]" && ret=0
- done
- (( ret )) && alwopt=${alwopt:-yes}
- tried=yes
- else
+ eval "action=( $action )"
+ while _next_label "$subc" expl "$descr"; do
+ "$action[@]" && ret=0
+ done
+ (( ret )) && alwopt=${alwopt:-yes}
+ tried=yes
+ else
- # Otherwise we call it with the description-arguments.
+ # Otherwise we call it with the description-arguments.
- eval "action=( $action )"
- while _next_label "$subc" expl "$descr"; do
- "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}" && ret=0
- done
- (( ret )) && alwopt=${alwopt:-yes}
- tried=yes
+ eval "action=( $action )"
+ while _next_label "$subc" expl "$descr"; do
+ "$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}" && ret=0
+ done
+ (( ret )) && alwopt=${alwopt:-yes}
+ tried=yes
+ fi
fi
fi
- fi
- done
+ done
+ fi
if [[ -z "$hasopts" &&
-z "$matched" &&
( -z "$tried" || -n "$alwopt" ) &&
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next prev parent reply other threads:[~2001-06-06 9:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-01 22:28 Andrej Borsenkow
2001-06-02 0:04 ` Peter Stephenson
2001-06-02 1:07 ` Bart Schaefer
2001-06-02 3:52 ` Bart Schaefer
2001-06-06 9:21 ` Sven Wischnowsky [this message]
2001-06-06 9:51 ` PATCH: " Peter Stephenson
2001-06-06 10:18 ` Branch patches (Re: PATCH: Re: 4.0.1 - arguments test fails) Bart Schaefer
2001-06-06 10:51 ` PATCH: Re: 4.0.1 - arguments test fails Sven Wischnowsky
2001-06-06 10:58 ` Bart Schaefer
2001-06-06 11:06 ` Sven Wischnowsky
2001-06-06 11:00 ` Andrej Borsenkow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200106060921.LAA23449@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).