zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: typeset completion with arguments after cursor
Date: Thu, 11 Aug 2016 21:34:58 +0200	[thread overview]
Message-ID: <83210.1470944098@hydra.kiddle.eu> (raw)
In-Reply-To: <CAHYJk3R6DV_w-r1qtGdRMWkMMqFziS5i8scNYpq=Sxstz5pQbA@mail.gmail.com>

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;


      reply	other threads:[~2016-08-11 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11  5:31 Mikael Magnusson
2016-08-11 19:34 ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83210.1470944098@hydra.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).