zsh-workers
 help / color / mirror / code / Atom feed
* typeset completion with arguments after cursor
@ 2016-08-11  5:31 Mikael Magnusson
  2016-08-11 19:34 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2016-08-11  5:31 UTC (permalink / raw)
  To: zsh workers

When you do this
typeset -<tab> a
it just completes an equal sign, instead of the correct options.
Without the `a` present it works fine, but I'm not sure what is
missing from the completion to make this work correctly, and it seems
to use some extra magic than usual as well. "This function uses whacky
features of _arguments"

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: typeset completion with arguments after cursor
  2016-08-11  5:31 typeset completion with arguments after cursor Mikael Magnusson
@ 2016-08-11 19:34 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2016-08-11 19:34 UTC (permalink / raw)
  To: zsh workers

Mikael Magnusson wrote:
> When you do this
> typeset -<tab> a
> it just completes an equal sign, instead of the correct options.
> Without the `a` present it works fine, but I'm not sure what is
> missing from the completion to make this work correctly, and it seems
> to use some extra magic than usual as well. "This function uses whacky
> features of _arguments"

This is a bug in the way the -A option is handled. It is trying the
pattern against all arguments. So the "a" argument doesn't match "-A" and
it disables all option completion. This patch prevents the pattern check for
arguments preceding (and including) the one we are currently completing.

I'm resending this message as it didn't come through from the list first
time. Sorry if it now arrives twice.

Oliver

diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index 0028ac1..ecfa2bc 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -2167,9 +2167,11 @@ ca_parse_line(Cadef d, int multi, int first)
 #endif
 		   )
 	    return 1;
-	else if (state.arg && (!napat || !pattry(napat, line))) {
+	else if (state.arg &&
+		 (!napat || cur <= compcurrent || !pattry(napat, line))) {
 	    /* Otherwise it's a normal argument. */
-	    if (napat && ca_inactive(d, NULL, cur + 1, 1, NULL))
+	    if (napat && cur <= compcurrent &&
+		    ca_inactive(d, NULL, cur + 1, 1, NULL))
 		return 1;
 
 	    arglast = 1;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-11 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11  5:31 typeset completion with arguments after cursor Mikael Magnusson
2016-08-11 19:34 ` Oliver Kiddle

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).