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

Re: [PATCH] Merge ignore and deduplication patterns in _sequence



Thank you for the review.

I believe there is one more issue. In the following example:

  compdef '_sequence _wanted tag expl desc compadd - 1 2 3' foo

the `tag` is not known to _sequence yet. So a user can't ignore matches
using e.g.

  zstyle ':completion:*:foo:*:tag' ignored-patterns 2 '2,*' '*,2,*' '*,2'

which is a bit inconsistent. I'd have fixed it by merging _sequence
patterns with _comp_ignore in _description, but that would be too much
code changes for a small gain.

For now, I suggest to ignore -F and its argument in order to fix the
`command not found: -F` error (patch attached).
diff --git a/Completion/Base/Utility/_sequence b/Completion/Base/Utility/_sequence
index c1ff32184..1a87c1753 100644
--- a/Completion/Base/Utility/_sequence
+++ b/Completion/Base/Utility/_sequence
@@ -8,10 +8,10 @@
 # -d     : duplicate values allowed
 
 local curcontext="$curcontext" nm="$compstate[nmatches]" pre qsep nosep minus
-local -a opts sep num pref suf cont end uniq dedup
+local -a opts sep num pref suf cont end uniq dedup garbage
 
 zparseopts -D -a opts s:=sep n:=num p:=pref i:=pref P:=pref I:=suf S:=suf \
-    q=suf r:=suf R:=suf C:=cont d=uniq M+: J+: V+: 1 2 o+: X+: x+:
+    q=suf r:=suf R:=suf C:=cont F:=garbage d=uniq M+: J+: V+: 1 2 o+: X+: x+:
 (( $#cont )) && curcontext="${curcontext%:*}:$cont[2]"
 (( $#sep )) || sep[2]=,
 
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 51f604bcf..a00103946 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -216,6 +216,16 @@ F:regression test workers/31611
 >NO:{3pm}
 >NO:{10pm}
 
+  comptesteval "_tst() { _arguments ':desc:_sequence compadd - 1 2 3' }"
+  comptesteval "zstyle ':completion:*:tst:*' ignored-patterns 2"
+  comptest $'tst 1,\t'
+  comptesteval "zstyle -d ':completion:*:tst:*' ignored-patterns"
+0:-F doesn't break _sequence
+>line: {tst 1,}{}
+>DESCRIPTION:{desc}
+>NO:{2}
+>NO:{3}
+
  comptest $'a=() b=(\t'
 0:multiple envarrays
 >line: {a=() b=(}{}


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