zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Cc: 733075@bugs.debian.org
Subject: Re: Bug#733075: Bug#733075: zsh: command completion not working after semicolon
Date: Wed, 25 Dec 2013 10:13:36 -0800	[thread overview]
Message-ID: <131225101336.ZM17671@torch.brasslantern.com> (raw)
In-Reply-To: <8738lhqjny.fsf@ft.bewatermyfriend.org>

On Dec 25, 12:01pm, Frank Terbeck wrote:
}
} I git-bisected this to:
} 
} [568e0db7a964feefa45061967d0c7079a0e59c1e]
}   31611: attempt to fix crash completing redirection in do loop
} 
} This is in zle_tricky.c, so naturally I'm afraid to touch it. :)

I think this is the right thing, but it would be helpful if someone
can also check that the redirection issue has not regressed.  (There
are no tests of command completion in Y01, so I'm not sure how to
add a regression test for these.)

diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 25f09c4..9d163ad 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -1071,7 +1071,7 @@ has_real_token(const char *s)
 static char *
 get_comp_string(void)
 {
-    enum lextok t0, tt0;
+    enum lextok t0, tt0, cmdtok;
     int i, j, k, cp, rd, sl, ocs, ins, oins, ia, parct, varq = 0;
     int ona = noaliases;
     /*
@@ -1146,6 +1146,7 @@ get_comp_string(void)
     linredir = inredir;
     zsfree(cmdstr);
     cmdstr = NULL;
+    cmdtok = NULLTOK;
     zsfree(varname);
     varname = NULL;
     insubscr = 0;
@@ -1264,6 +1265,7 @@ get_comp_string(void)
 	    ins = (tok == REPEAT ? 2 : (tok != STRING));
 	    zsfree(cmdstr);
 	    cmdstr = ztrdup(tokstr);
+	    cmdtok = tok;
 	    /* If everything before is a redirection, don't reset the index */
 	    if (wordpos != redirpos)
 		wordpos = redirpos = 0;
@@ -1271,10 +1273,11 @@ get_comp_string(void)
 	    /*
 	     * A following DOLOOP should cause us to reset to the start
 	     * of the command line.  For some reason we only recognise
-	     * DOLOOP for this purpose (above) if ins is set.  Why?
-	     * Don't ask pointless questions.
+	     * DOLOOP for this purpose (above) if ins is set.  Why?  To
+	     * handle completing multiple SEPER-ated command positions on
+	     * the same command line, e.g., pipelines.
 	     */
-	    ins = 1;
+	    ins = (cmdtok != STRING);
 	}
 	if (!lexflags && tt0 == NULLTOK) {
 	    /* This is done when the lexer reached the word the cursor is on. */


  reply	other threads:[~2013-12-25 18:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20131224214220.2173519380.qww314159@soup.q.qbilt.org>
2013-12-25  8:19 ` Fwd: [Pkg-zsh-devel] " Richard Hartmann
2013-12-25  8:38   ` Richard Hartmann
     [not found] ` <877gatqlp3.fsf@ft.bewatermyfriend.org>
     [not found]   ` <CAD77+gRdTo6gN-XJWckqy7sn5afE6r5CPsp2E3MqxoWJTdup6Q@mail.gmail.com>
2013-12-25 11:01     ` Bug#733075: " Frank Terbeck
2013-12-25 18:13       ` Bart Schaefer [this message]
2014-01-02 18:16         ` Peter Stephenson
2014-01-02 20:42           ` Bart Schaefer
2014-01-02 21:38           ` Oliver Kiddle

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=131225101336.ZM17671@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=733075@bugs.debian.org \
    --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).