summary refs log tree commit diff
path: root/Completion/Commands
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Commands')
-rw-r--r--Completion/Commands/_next_tags12
1 files changed, 10 insertions, 2 deletions
diff --git a/Completion/Commands/_next_tags b/Completion/Commands/_next_tags
index 867cf0b98..d9a5f08d8 100644
--- a/Completion/Commands/_next_tags
+++ b/Completion/Commands/_next_tags
@@ -92,12 +92,20 @@ _next_tags_sort() {
   if [[ -z "$nodef" ]]; then
     if [[ $funcstack[4] = _files ]]; then
       if zstyle -a ":completion:${curcontext}:" file-patterns tmp; then
-        [[ "$argv" = *${${tmp[-1]##[^\\]:}%:*}* ]] && _next_tags_reset=yes
+        [[ "$argv" = *${${tmp[-1]#*[^\\]:}%:*}* ]] && _next_tags_reset=yes
       else
         [[ "$argv" = *all-files* ]] && _next_tags_reset=yes
       fi
     fi
-    comptry "${(@)argv:#(${(j:|:)~${=_next_tags_not}})(|:*)}"
+    tmp=( "${(@)argv:#(${(j:|:)~${=_next_tags_not}})(|:*)}" )
+
+    # $prev is set in _tags!
+
+    if [[ -n "$prev" && ( $#tmp -ne 0 || $funcstack[4] = _files ) ]]; then
+      comptry "$tmp[@]"
+    else
+      comptry "$argv[@]"
+    fi
   fi
 }