* [PATCH] Fix zstyle option completion
@ 2020-12-13 4:15 dana
2020-12-13 17:31 ` Daniel Shahaf
0 siblings, 1 reply; 5+ messages in thread
From: dana @ 2020-12-13 4:15 UTC (permalink / raw)
To: Zsh hackers list; +Cc: Daniel Shahaf
I often retrieve zstyle commands from history and then edit them to add -d or
whatever at the beginning. But the completion function won't complete for you
there because of the change made by Daniel in workers/39659.
@Daniel: I think this achieves what you wanted without breaking my use case,
doesn't it? Or did you have something else in mind that i'm not seeing?
dana
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index 75acde5f7..9e82d8ad5 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -217,7 +217,7 @@ taglist=(
)
# Be careful with the context arguments here. They like to masquerade.
-_arguments -C \
+_arguments -C -A '-*' \
'(: -)-L[output in form of zstyle commands]:pattern for context patterns:->metapatterns:style:->metastyles' \
'(: -)-d[delete style definitions]:verbatim context pattern:->patterns:*:styles:->pstyles' \
'(: -)-e[value is evaluated when style is looked up]:context pattern:->contexts:style:->styles:*:command:_cmdstring' \
@@ -228,7 +228,7 @@ _arguments -C \
'(: -)-t[test a style, returning false if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \
'(: -)-T[test a style, returning true if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \
'(: -)-m[pattern-match values of a style]:context name:->contexts:style:->styles:pattern: ' \
- '(-):context pattern:->contexts' '(-):style:->styles' '(-)*:argument:->style-arg'
+ ':context pattern:->contexts' ':style:->styles' '*:argument:->style-arg'
while (( $#state )); do
case "$state[1]" in
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix zstyle option completion
2020-12-13 4:15 [PATCH] Fix zstyle option completion dana
@ 2020-12-13 17:31 ` Daniel Shahaf
2020-12-14 9:55 ` dana
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Shahaf @ 2020-12-13 17:31 UTC (permalink / raw)
To: dana; +Cc: Zsh hackers list
dana wrote on Sat, Dec 12, 2020 at 22:15:47 -0600:
> I often retrieve zstyle commands from history and then edit them to add -d or
> whatever at the beginning. But the completion function won't complete for you
> there because of the change made by Daniel in workers/39659.
>
A regression, then? Sorry about that.
Could you clarify the precise LBUFFER/RBUFFER values that "won't
complete"?
> @Daniel: I think this achieves what you wanted without breaking my use case,
> doesn't it? Or did you have something else in mind that i'm not seeing?
What I had in mind in that commit was to complete the correct non-option
arguments after the options listed in the log message; e.g., «zstyle -s
<TAB>», «zstyle -s foo <TAB>», «zstyle -s foo bar <TAB>».
The «(-)» exclusions in the line changed were designed to make that line
complete the "set a zstyle" syntax, «zstyle foo bar baz» without any of
the options (not even -e, which is handled separately).
As written, I think the patch will cause «zstyle -g foo bar baz <TAB>»
to offer completions, whereas currently it correctly completes nothing.
(Just observing; not implying any conclusions.)
Cheers,
Daniel
(ENOTIME to test, sorry)
> diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
> index 75acde5f7..9e82d8ad5 100644
> --- a/Completion/Zsh/Command/_zstyle
> +++ b/Completion/Zsh/Command/_zstyle
> @@ -217,7 +217,7 @@ taglist=(
> )
>
> # Be careful with the context arguments here. They like to masquerade.
> -_arguments -C \
> +_arguments -C -A '-*' \
> '(: -)-L[output in form of zstyle commands]:pattern for context patterns:->metapatterns:style:->metastyles' \
> '(: -)-d[delete style definitions]:verbatim context pattern:->patterns:*:styles:->pstyles' \
> '(: -)-e[value is evaluated when style is looked up]:context pattern:->contexts:style:->styles:*:command:_cmdstring' \
> @@ -228,7 +228,7 @@ _arguments -C \
> '(: -)-t[test a style, returning false if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \
> '(: -)-T[test a style, returning true if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \
> '(: -)-m[pattern-match values of a style]:context name:->contexts:style:->styles:pattern: ' \
> - '(-):context pattern:->contexts' '(-):style:->styles' '(-)*:argument:->style-arg'
> + ':context pattern:->contexts' ':style:->styles' '*:argument:->style-arg'
>
> while (( $#state )); do
> case "$state[1]" in
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix zstyle option completion
2020-12-13 17:31 ` Daniel Shahaf
@ 2020-12-14 9:55 ` dana
2021-03-27 20:08 ` Lawrence Velázquez
0 siblings, 1 reply; 5+ messages in thread
From: dana @ 2020-12-14 9:55 UTC (permalink / raw)
To: Daniel Shahaf; +Cc: Zsh hackers list
On 13 Dec 2020, at 11:31, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Could you clarify the precise LBUFFER/RBUFFER values that "won't
> complete"?
For example, when i do:
# LBUFFER='zstyle -'
# RBUFFER=' foo bar'
% zstyle -<TAB> foo bar
... it tries (unsuccessfully) to complete argument-1 instead of showing me
options.
On 13 Dec 2020, at 11:31, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> As written, I think the patch will cause «zstyle -g foo bar baz <TAB>»
> to offer completions, whereas currently it correctly completes nothing.
I don't think it should. All the options are exclusive with each other, so
that takes care of that already, and the -A '-*' should handle cases like
`zstyle foo bar <TAB>`. It gives me 'no more arguments' when i test your
example with my change. But i might not fully understand what you mean
dana
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix zstyle option completion
2020-12-14 9:55 ` dana
@ 2021-03-27 20:08 ` Lawrence Velázquez
2021-03-29 13:46 ` Daniel Shahaf
0 siblings, 1 reply; 5+ messages in thread
From: Lawrence Velázquez @ 2021-03-27 20:08 UTC (permalink / raw)
To: zsh-workers
On Mon, Dec 14, 2020, at 4:55 AM, dana wrote:
> On 13 Dec 2020, at 11:31, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > Could you clarify the precise LBUFFER/RBUFFER values that "won't
> > complete"?
>
> For example, when i do:
>
> # LBUFFER='zstyle -'
> # RBUFFER=' foo bar'
> % zstyle -<TAB> foo bar
>
> ... it tries (unsuccessfully) to complete argument-1 instead of showing me
> options.
>
> On 13 Dec 2020, at 11:31, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > As written, I think the patch will cause «zstyle -g foo bar baz <TAB>»
> > to offer completions, whereas currently it correctly completes nothing.
>
> I don't think it should. All the options are exclusive with each other, so
> that takes care of that already, and the -A '-*' should handle cases like
> `zstyle foo bar <TAB>`. It gives me 'no more arguments' when i test your
> example with my change. But i might not fully understand what you mean
Anything further on this?
vq
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix zstyle option completion
2021-03-27 20:08 ` Lawrence Velázquez
@ 2021-03-29 13:46 ` Daniel Shahaf
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Shahaf @ 2021-03-29 13:46 UTC (permalink / raw)
To: Lawrence Velázquez, dana; +Cc: zsh-workers
Lawrence Velázquez wrote on Sat, Mar 27, 2021 at 16:08:12 -0400:
> On Mon, Dec 14, 2020, at 4:55 AM, dana wrote:
> > On 13 Dec 2020, at 11:31, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > > Could you clarify the precise LBUFFER/RBUFFER values that "won't
> > > complete"?
> >
> > For example, when i do:
> >
> > # LBUFFER='zstyle -'
> > # RBUFFER=' foo bar'
> > % zstyle -<TAB> foo bar
> >
> > ... it tries (unsuccessfully) to complete argument-1 instead of showing me
> > options.
> >
> > On 13 Dec 2020, at 11:31, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > > As written, I think the patch will cause «zstyle -g foo bar baz <TAB>»
> > > to offer completions, whereas currently it correctly completes nothing.
> >
> > I don't think it should. All the options are exclusive with each other, so
> > that takes care of that already, and the -A '-*' should handle cases like
> > `zstyle foo bar <TAB>`. It gives me 'no more arguments' when i test your
> > example with my change. But i might not fully understand what you mean
>
> Anything further on this?
Pushed. Also fixed the X-Seq's in ChangeLog while I was at it. Thank
you both!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-29 13:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-13 4:15 [PATCH] Fix zstyle option completion dana
2020-12-13 17:31 ` Daniel Shahaf
2020-12-14 9:55 ` dana
2021-03-27 20:08 ` Lawrence Velázquez
2021-03-29 13:46 ` Daniel Shahaf
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).