Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: Bugs thrown up by _perforce



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.



Messages sorted by: Reverse Date, Date, Thread, Author