From 48df213153610e302b94c866f869a5861e359349 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 26 Feb 2003 16:35:55 +0000 Subject: 18299: allow _next_tags to work with nested tag loops --- Completion/Base/Core/_all_labels | 2 ++ Completion/Base/Core/_main_complete | 1 + Completion/Base/Core/_next_label | 2 ++ Completion/Base/Widget/_next_tags | 4 ++++ 4 files changed, 9 insertions(+) (limited to 'Completion') diff --git a/Completion/Base/Core/_all_labels b/Completion/Base/Core/_all_labels index 9dda58131..e607d639d 100644 --- a/Completion/Base/Core/_all_labels +++ b/Completion/Base/Core/_all_labels @@ -24,6 +24,8 @@ else 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" diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index a78d0ec42..c0216a942 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -23,6 +23,7 @@ local func funcs ret=1 tmp _compskip format nm call match min max i num\ _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]}" \ diff --git a/Completion/Base/Core/_next_label b/Completion/Base/Core/_next_label index ff9b658a1..64506d05a 100644 --- a/Completion/Base/Core/_next_label +++ b/Completion/Base/Core/_next_label @@ -6,6 +6,8 @@ __gopt=() 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" diff --git a/Completion/Base/Widget/_next_tags b/Completion/Base/Widget/_next_tags index eaf7e3ace..c6d095482 100644 --- a/Completion/Base/Widget/_next_tags +++ b/Completion/Base/Widget/_next_tags @@ -34,6 +34,8 @@ _next_tags() { 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 @@ _next_tags() { 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 -- cgit 1.4.1