Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Merge ignore and deduplication patterns in _sequence
- X-seq: zsh-workers 45895
- From: oxiedi <oxiedi@xxxxxxxxx>
- To: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- Subject: Re: [PATCH] Merge ignore and deduplication patterns in _sequence
- Date: Sat, 23 May 2020 00:02:47 +0500
- Authentication-results: mxback28j.mail.yandex.net; dkim=pass header.i=@yandex.ru
- Cc: zsh-workers@xxxxxxx
- Envelope-from: oxiedi@xxxxxxxxx
- In-reply-to: <57004-1590065025.229907@6d4A.1jvX.h7ap>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <3932941583753550@myt2-a7d7570d35ff.qloud-c.yandex.net> <57004-1590065025.229907@6d4A.1jvX.h7ap>
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