zsh-workers
 help / color / mirror / code / Atom feed
* current CVS test failure
@ 2003-04-30  6:41 Borzenkov Andrey
  2003-04-30  9:29 ` Peter Stephenson
  0 siblings, 1 reply; 12+ messages in thread
From: Borzenkov Andrey @ 2003-04-30  6:41 UTC (permalink / raw)
  To: 'zsh-workers@sunsite.dk'

/tools/src/zsh/Test/Y03arguments.ztst: starting.
*** /tmp/zsh.ztst.out.17618     Wed Apr 30 10:33:24 2003
--- /tmp/zsh.ztst.tout.17618    Wed Apr 30 10:33:27 2003
***************
*** 1,8 ****
  line: {tst -o }{}
! line: {tst -o +o }{}
! line: {tst -o +o }{}
  MESSAGE:{no arguments}
! line: {tst +o }{}
! line: {tst +o -o }{}
! line: {tst +o -o }{}
  MESSAGE:{no arguments}
--- 1,8 ----
  line: {tst -o }{}
! line: {tst -o }{}
  MESSAGE:{no arguments}
! line: {tst -o }{}
  MESSAGE:{no arguments}
+ line: {+}{}
+ line: {+}{}
+ line: {+}{}
Test /tools/src/zsh/Test/Y03arguments.ztst failed: output differs from
expected as shown above for:
 tst_arguments -+o
 comptest $'tst -\t\t\t\C-w\C-w+\t\t\t'
Was testing: option beginning with + and -.
/tools/src/zsh/Test/Y03arguments.ztst: test failed.

-andrey


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-04-30  6:41 current CVS test failure Borzenkov Andrey
@ 2003-04-30  9:29 ` Peter Stephenson
  2003-04-30 13:39   ` Oliver Kiddle
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Stephenson @ 2003-04-30  9:29 UTC (permalink / raw)
  To: 'zsh-workers@sunsite.dk'

Borzenkov Andrey wrote:
> /tools/src/zsh/Test/Y03arguments.ztst: starting.
> Test /tools/src/zsh/Test/Y03arguments.ztst failed: output differs from
> expected as shown above for:
>  tst_arguments -+o
>  comptest $'tst -\t\t\t\C-w\C-w+\t\t\t'
> Was testing: option beginning with + and -.
> /tools/src/zsh/Test/Y03arguments.ztst: test failed.

see zsh-workers/18475, still awaiting confirmation of the fix but I may
simply commit it this evening when I get home.

pws


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-04-30  9:29 ` Peter Stephenson
@ 2003-04-30 13:39   ` Oliver Kiddle
  2003-04-30 13:52     ` Peter Stephenson
  2003-04-30 13:56     ` Oliver Kiddle
  0 siblings, 2 replies; 12+ messages in thread
From: Oliver Kiddle @ 2003-04-30 13:39 UTC (permalink / raw)
  To: zsh-workers

Peter wrote:
> 
> see zsh-workers/18475, still awaiting confirmation of the fix but I may
> simply commit it this evening when I get home.

Sorry, I've had a busy week and haven't had a chance to look at this.

Unfortunately, the _describe change has a problem so we don't want to be
contriving the tests. Note that the test is using _arguments and not
_describe. I'm going to back out that change until I have more time to
think of a better solution.

The test is doing _arguments '-+o'. Because there are no other
(non-option) things being completed, it adds the -o and +o regardless
of the prefix. In _describe, I can't know if _arguments is completing
other things so I can't think of any easy solution other than checking
prefix-needed manually in any other function using _describe -o.

Oliver


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-04-30 13:39   ` Oliver Kiddle
@ 2003-04-30 13:52     ` Peter Stephenson
  2003-04-30 14:30       ` Oliver Kiddle
  2003-05-12 10:08       ` Oliver Kiddle
  2003-04-30 13:56     ` Oliver Kiddle
  1 sibling, 2 replies; 12+ messages in thread
From: Peter Stephenson @ 2003-04-30 13:52 UTC (permalink / raw)
  To: zsh-workers

Oliver Kiddle wrote:
> The test is doing _arguments '-+o'. Because there are no other
> (non-option) things being completed, it adds the -o and +o regardless
> of the prefix. In _describe, I can't know if _arguments is completing
> other things so I can't think of any easy solution other than checking
> prefix-needed manually in any other function using _describe -o.

how about adding another option to _describe e.g. -O which works the
same but doesn't test prefix-needed and only gets called from
_arguments?

Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.14
diff -u -r1.14 _arguments
--- Completion/Base/Utility/_arguments	23 May 2002 12:20:15 -0000	1.14
+++ Completion/Base/Utility/_arguments	30 Apr 2003 13:51:27 -0000
@@ -387,7 +387,7 @@
 	    tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
 	    tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
 
-            _describe -o option \
+            _describe -O option \
                       tmp1 tmp2 -Q -S '' -- \
 		      tmp3 -Q
 
@@ -399,7 +399,7 @@
           single=yes
         else
           next=( "$next[@]" "$odirect[@]" )
-          _describe -o option \
+          _describe -O option \
                     next -Q -M "$matcher" -- \
                     direct -QS '' -M "$matcher" -- \
                     equal -QqS= -M "$matcher"
Index: Completion/Base/Utility/_describe
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_describe,v
retrieving revision 1.14
diff -u -r1.14 _describe
--- Completion/Base/Utility/_describe	22 Apr 2003 12:33:08 -0000	1.14
+++ Completion/Base/Utility/_describe	30 Apr 2003 13:51:27 -0000
@@ -2,7 +2,7 @@
 
 # This can be used to add options or values with descriptions as matches.
 
-local _opt _expl _tmpm _tmpd _mlen
+local _opt _expl _tmpm _tmpd _mlen _noprefix
 local _type=values _descr _ret=1 _showd _nm _hide _args _grp _sep
 local csl="$compstate[list]" csl2
 local _oargv _argv _new _strs _mats _opts _i _try=0
@@ -12,6 +12,10 @@
 if [[ "$1" = -o ]]; then
   _type=options
   shift
+elif [[ "$1" = -O ]]; then
+  _type=options
+  _noprefix=1
+  shift
 elif [[ "$1" = -t ]]; then
   _type="$2"
   shift 2
@@ -20,7 +24,7 @@
   shift
 fi
 
-[[ "$_type" = options && ! -prefix [-+]* ]] && \
+[[ "$_type$_noprefix" = options && ! -prefix [-+]* ]] && \
     zstyle -T ":completion:${curcontext}:options" prefix-needed &&
         return 1
 

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-04-30 13:39   ` Oliver Kiddle
  2003-04-30 13:52     ` Peter Stephenson
@ 2003-04-30 13:56     ` Oliver Kiddle
  2003-04-30 14:01       ` Borzenkov Andrey
  1 sibling, 1 reply; 12+ messages in thread
From: Oliver Kiddle @ 2003-04-30 13:56 UTC (permalink / raw)
  To: zsh-workers

I wrote:

> _describe. I'm going to back out that change until I have more time to
> think of a better solution.

I've just realised, the documentation for _describe's -o option still
states that _describe will use the prefix-needed style. With this backed
out it doesn't. So if you're planning to make a release in the next few
days, you may want to correct it.

I'm going to be away for a few days so am not going to have a chance to
think about this in any more detail just yet.

Oliver


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: current CVS test failure
  2003-04-30 13:56     ` Oliver Kiddle
@ 2003-04-30 14:01       ` Borzenkov Andrey
  0 siblings, 0 replies; 12+ messages in thread
From: Borzenkov Andrey @ 2003-04-30 14:01 UTC (permalink / raw)
  To: zsh-workers


                   So if you're planning to make a release in the next few
> days, you may want to correct it.

If you really plan to make a release, please look at "PATCH: fix menu
completion on terminal with do=^J/without do"; it did fix things on Linux
console at lease.

Thanks

-andrey


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-04-30 13:52     ` Peter Stephenson
@ 2003-04-30 14:30       ` Oliver Kiddle
  2003-05-12 10:08       ` Oliver Kiddle
  1 sibling, 0 replies; 12+ messages in thread
From: Oliver Kiddle @ 2003-04-30 14:30 UTC (permalink / raw)
  To: zsh-workers

Peter wrote:
> Oliver Kiddle wrote:
> > The test is doing _arguments '-+o'. Because there are no other
> > (non-option) things being completed, it adds the -o and +o regardless
> > of the prefix. In _describe, I can't know if _arguments is completing
> > other things so I can't think of any easy solution other than checking
> > prefix-needed manually in any other function using _describe -o.
> 
> how about adding another option to _describe e.g. -O which works the
> same but doesn't test prefix-needed and only gets called from
> _arguments?

Possibly.

I was hoping to experiment with a few things because I've got a couple
of other vague ideas. Functions other than _arguments might also be
completing things besides options so would also need the -O behaviour.

Anyway, I've got a train to catch so I can't do anything till next week.

Oliver


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-04-30 13:52     ` Peter Stephenson
  2003-04-30 14:30       ` Oliver Kiddle
@ 2003-05-12 10:08       ` Oliver Kiddle
  2003-05-13  9:54         ` Peter Stephenson
  1 sibling, 1 reply; 12+ messages in thread
From: Oliver Kiddle @ 2003-05-12 10:08 UTC (permalink / raw)
  To: Zsh workers

On 30 Apr, Peter wrote:
> Oliver Kiddle wrote:
> > The test is doing _arguments '-+o'. Because there are no other
> > (non-option) things being completed, it adds the -o and +o regardless
> > of the prefix. In _describe, I can't know if _arguments is completing
> > other things so I can't think of any easy solution other than checking
> > prefix-needed manually in any other function using _describe -o.
> 
> how about adding another option to _describe e.g. -O which works the
> same but doesn't test prefix-needed and only gets called from
> _arguments?

I couldn't think of a particularly better solution. A nasty hack would
involve looking at $compstate[nmatches] to see if anything else had
been completed but you can't rely on the options be completed after
whatever else. postfunctions aren't much use because they are run too
late after all the completers. In some respects prefix-needed is
actually redundant because the same can be achieved with the
ignored-patterns style.

So your -O is probably the best solution.

Oliver


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-05-12 10:08       ` Oliver Kiddle
@ 2003-05-13  9:54         ` Peter Stephenson
  2003-05-13 13:27           ` Oliver Kiddle
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Stephenson @ 2003-05-13  9:54 UTC (permalink / raw)
  To: Zsh workers

Oliver Kiddle wrote:
> So your -O is probably the best solution.

With documentation added, it now looks like the following.

I notice the option only affects prefix-needed, not prefix-hidden, which
was always handled by _describe.  That's probably OK as this is a matter
for displaying.

Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.169
diff -u -r1.169 compsys.yo
--- Doc/Zsh/compsys.yo	25 Apr 2003 11:19:09 -0000	1.169
+++ Doc/Zsh/compsys.yo	13 May 2003 09:51:39 -0000
@@ -3665,7 +3665,7 @@
 the functions for the fields if they are called.
 )
 findex(_describe)
-item(tt(_describe) [ tt(-o) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)(
+item(tt(_describe) [ tt(-oO) | tt(-t) var(tag) ] var(descr) var(name1) [ var(name2) ] var(opts) ... tt(-)tt(-) ...)(
 This function associates completions with descriptions.
 Multiple groups separated by tt(-)tt(-) can be supplied, potentially with
 different completion options var(opts).
@@ -3688,7 +3688,10 @@
 tt(prefix-needed) and tt(verbose) styles to find out if the strings should
 be added as completions and if the descriptions should be shown.  Without
 the `tt(-o)' option, only the tt(verbose) style is used to decide how
-descriptions are shown.
+descriptions are shown.  If `tt(-O)' is used instead of `tt(-O)', command
+options are completed as above but tt(_describe) will not handle the
+tt(prefix-needed) style which is assumed to be handled by the calling
+function.
 
 With the tt(-t) option a var(tag) can be specified.  The default is
 `tt(values)' or, if the tt(-o) option is given, `tt(options)'.
Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.14
diff -u -r1.14 _arguments
--- Completion/Base/Utility/_arguments	23 May 2002 12:20:15 -0000	1.14
+++ Completion/Base/Utility/_arguments	13 May 2003 09:51:39 -0000
@@ -387,7 +387,7 @@
 	    tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
 	    tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
 
-            _describe -o option \
+            _describe -O option \
                       tmp1 tmp2 -Q -S '' -- \
 		      tmp3 -Q
 
@@ -399,7 +399,7 @@
           single=yes
         else
           next=( "$next[@]" "$odirect[@]" )
-          _describe -o option \
+          _describe -O option \
                     next -Q -M "$matcher" -- \
                     direct -QS '' -M "$matcher" -- \
                     equal -QqS= -M "$matcher"
Index: Completion/Base/Utility/_describe
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_describe,v
retrieving revision 1.15
diff -u -r1.15 _describe
--- Completion/Base/Utility/_describe	30 Apr 2003 13:47:55 -0000	1.15
+++ Completion/Base/Utility/_describe	13 May 2003 09:51:39 -0000
@@ -2,7 +2,7 @@
 
 # This can be used to add options or values with descriptions as matches.
 
-local _opt _expl _tmpm _tmpd _mlen
+local _opt _expl _tmpm _tmpd _mlen _noprefix
 local _type=values _descr _ret=1 _showd _nm _hide _args _grp _sep
 local csl="$compstate[list]" csl2
 local _oargv _argv _new _strs _mats _opts _i _try=0
@@ -12,6 +12,10 @@
 if [[ "$1" = -o ]]; then
   _type=options
   shift
+elif [[ "$1" = -O ]]; then
+  _type=options
+  _noprefix=1
+  shift
 elif [[ "$1" = -t ]]; then
   _type="$2"
   shift 2
@@ -19,6 +23,10 @@
   _type="${1[3,-1]}"
   shift
 fi
+
+[[ "$_type$_noprefix" = options && ! -prefix [-+]* ]] && \
+    zstyle -T ":completion:${curcontext}:options" prefix-needed &&
+        return 1
 
 # Do the tests. `showd' is set if the descriptions should be shown.
 

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-05-13  9:54         ` Peter Stephenson
@ 2003-05-13 13:27           ` Oliver Kiddle
  2003-05-14  9:33             ` Peter Stephenson
  2003-05-28 15:15             ` Oliver Kiddle
  0 siblings, 2 replies; 12+ messages in thread
From: Oliver Kiddle @ 2003-05-13 13:27 UTC (permalink / raw)
  To: Zsh workers

Peter wrote:
> Oliver Kiddle wrote:
> > So your -O is probably the best solution.

Sorry to complicate this but I did another experiment and I think the
compstate[nmatches] solution would work. I had thought that a tag-order of
'options arguments' (with quotes) would cause the completion of options
to execute before arguments even though they display together but that
is not the case: they execute in the same tag loop iteration so in the
order they are defined.

So, you would just have to make sure that anything calling _describe -o
came last in the tag loop. It would actually work better though because
it then does the job for you of seeing if options are completed alone
or with other things. It would also mean that a tag-order specifying
options before something else would complete the options first even if
there was no `-' prefix. Which is I think better.

So what do we prefer - an extra, obscure -O option to _describe or the
peculiar must be last in the tag loop rule but with it working slightly
better? Or does that explanation all make no sense?

> With documentation added, it now looks like the following.
> 
> I notice the option only affects prefix-needed, not prefix-hidden, which
> was always handled by _describe.  That's probably OK as this is a matter
> for displaying.

Yes, prefix-hidden is unrelated to this issue.

> +descriptions are shown.  If `tt(-O)' is used instead of `tt(-O)', command
> +options are completed as above but tt(_describe) will not handle the
> +tt(prefix-needed) style which is assumed to be handled by the calling
> +function.

-O is useful in contexts where only options are valid completions and so
they should always be completed regardless of the prefix. So you might
want to use -O and not handle prefix-needed in the calling function.

Oliver


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-05-13 13:27           ` Oliver Kiddle
@ 2003-05-14  9:33             ` Peter Stephenson
  2003-05-28 15:15             ` Oliver Kiddle
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Stephenson @ 2003-05-14  9:33 UTC (permalink / raw)
  To: Zsh workers

Oliver Kiddle wrote:
> So what do we prefer - an extra, obscure -O option to _describe or the
> peculiar must be last in the tag loop rule but with it working slightly
> better? Or does that explanation all make no sense?

I'm not particularly bothered one way or the other.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: current CVS test failure
  2003-05-13 13:27           ` Oliver Kiddle
  2003-05-14  9:33             ` Peter Stephenson
@ 2003-05-28 15:15             ` Oliver Kiddle
  1 sibling, 0 replies; 12+ messages in thread
From: Oliver Kiddle @ 2003-05-28 15:15 UTC (permalink / raw)
  To: Zsh workers

On 13 May, I wrote:
> Peter wrote:
> > Oliver Kiddle wrote:
> > > So your -O is probably the best solution.
> 
> Sorry to complicate this but I did another experiment and I think the
> compstate[nmatches] solution would work. I had thought that a tag-order of

Seems it won't work for _arguments where we have a '*' action which uses
a state. Currently _arguments assumes that something will be completed
for the state so doesn't offer options where prefix-needed is set and
that state completes nothing. _describe can't know if _arguments has
such a state. I can't think of any obvious way around this and haven't
really had time to tinker with _arguments in case there is some possible
hack.

So feel free to commit your _describe -o/-O thing. I'm sorry for holding
that up.

Oliver


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-05-28 15:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-30  6:41 current CVS test failure Borzenkov Andrey
2003-04-30  9:29 ` Peter Stephenson
2003-04-30 13:39   ` Oliver Kiddle
2003-04-30 13:52     ` Peter Stephenson
2003-04-30 14:30       ` Oliver Kiddle
2003-05-12 10:08       ` Oliver Kiddle
2003-05-13  9:54         ` Peter Stephenson
2003-05-13 13:27           ` Oliver Kiddle
2003-05-14  9:33             ` Peter Stephenson
2003-05-28 15:15             ` Oliver Kiddle
2003-04-30 13:56     ` Oliver Kiddle
2003-04-30 14:01       ` Borzenkov Andrey

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).