zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@sunsite.dk
Subject: PATCH: Re: Bugs thrown up by _perforce
Date: Wed, 26 Feb 2003 09:47:43 +0100	[thread overview]
Message-ID: <1203.1046249263@finches.logica.co.uk> (raw)
In-Reply-To: <22979.1046178445@csr.com>

Peter wrote:
> Oliver Kiddle wrote:
> > [_next_tags always inserts an unambiguous completion]
> >
> > You can fix this by changing the ins=unambiguous line to just ins= so
> > that compstate[insert] remains empty but this changes _next_tags
> > behaviour in other cases.
> 
> I'll test this out.

That would be useful.

> > behaviour would be. Does anyone want _next_tags to actually complete
> > stuff ever?
> 
> I can't see why --- certainly not treat it as an unambiguous insertion,
> fait accompli.  You can't even see what it's going to complete next.

Okay, I think it can be fixed then.

> > [an _arguments --- or any inner tags loop --- screws up _next_tags]

> Um.  I'm still a bit vague as to how all this works.  Can we prevent
> this behaviour happening with argument-rest?  After all, it's being
> smuggled in behind our back anyway --- it's not specified either in the
> styles, nor in the list of tags I'm explicitly generating.

You could but a more generic solution would be much better. The
argument- tags can be useful.

> Can we make the system remember we're in a nested loop?  And then inside
> it can be more lenient?  Or some combination of the tow?  Or something?

This patch should do the job. It only puts tags from the inner most tag
loops into $_lastcomp[tags] and hence $_next_tags_not. Not blocking an
outer loop tag does not matter because all inner tags will be blocked
for it so the effect is the same.

Does anyone see a problem with the change to what $_lastcomp[tags]
contains? Note that it isn't used by anything other than _next_tags.

Potential problems remain if the same tag names are used across
different branches (the inner loops of separate outer loops). Doing
that is otherwise not very sensible anyway.

Oliver

Index: Completion/Base/Core/_all_labels
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_all_labels,v
retrieving revision 1.2
diff -u -r1.2 _all_labels
--- Completion/Base/Core/_all_labels	12 Feb 2002 13:37:03 -0000	1.2
+++ Completion/Base/Core/_all_labels	26 Feb 2003 08:33:31 -0000
@@ -24,6 +24,8 @@
 fi
 
 while comptags "-A$__prev" "$1" curtag __spec; do
+  (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
+  _tags_level=$#funcstack
   _comp_tags="$_comp_tags $__spec "
   if [[ "$curtag" = *[^\\]:* ]]; then
     zformat -f __descr "${curtag#*:}" "d:$3"
Index: Completion/Base/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_main_complete,v
retrieving revision 1.6
diff -u -r1.6 _main_complete
--- Completion/Base/Core/_main_complete	26 Jun 2002 11:07:46 -0000	1.6
+++ Completion/Base/Core/_main_complete	26 Feb 2003 08:33:31 -0000
@@ -23,6 +23,7 @@
       _matchers _matcher _c_matcher _matcher_num _comp_tags _comp_mesg  \
       mesg str context state line opt_args val_args curcontext="$curcontext" \
       _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \
+      _tags_level=0 \
       _saved_exact="${compstate[exact]}" \
       _saved_lastprompt="${compstate[last_prompt]}" \
       _saved_list="${compstate[list]}" \
Index: Completion/Base/Core/_next_label
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Core/_next_label,v
retrieving revision 1.2
diff -u -r1.2 _next_label
--- Completion/Base/Core/_next_label	12 Feb 2002 13:37:04 -0000	1.2
+++ Completion/Base/Core/_next_label	26 Feb 2003 08:33:31 -0000
@@ -6,6 +6,8 @@
 zparseopts -D -a __gopt 1 2 V J x
 
 if comptags -A "$1" curtag __spec; then
+  (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
+  _tags_level=$#funcstack
   _comp_tags="$_comp_tags $__spec "
   if [[ "$curtag" = *[^\\]:* ]]; then
     zformat -f __descr "${curtag#*:}" "d:$3"
Index: Completion/Base/Widget/_next_tags
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Widget/_next_tags,v
retrieving revision 1.3
diff -u -r1.3 _next_tags
--- Completion/Base/Widget/_next_tags	25 Feb 2003 18:43:51 -0000	1.3
+++ Completion/Base/Widget/_next_tags	26 Feb 2003 08:33:31 -0000
@@ -34,6 +34,8 @@
     fi
 
     while comptags "-A$__prev" "$1" curtag __spec; do
+      (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
+      _tags_level=$#funcstack
       [[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
       _comp_tags="$_comp_tags $__spec "
       if [[ "$curtag" = *[^\\]:* ]]; then
@@ -59,6 +61,8 @@
     zparseopts -D -a __gopt 1 2 V J x
 
     if comptags -A "$1" curtag __spec; then
+      (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
+      _tags_level=$#funcstack
       [[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
       _comp_tags="$_comp_tags $__spec "
       if [[ "$curtag" = *[^\\]:* ]]; then

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


  reply	other threads:[~2003-02-26  8:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-23 16:02 Peter Stephenson
2003-02-24 14:50 ` Oliver Kiddle
2003-02-25 13:07   ` Peter Stephenson
2003-02-26  8:47     ` Oliver Kiddle [this message]
2003-03-11 13:10     ` PATCH: " Oliver Kiddle
2003-03-12 11:48       ` Peter Stephenson

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=1203.1046249263@finches.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --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).