From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22110 invoked by alias); 25 Dec 2013 18:14:03 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32182 Received: (qmail 14371 invoked from network); 25 Dec 2013 18:13:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <131225101336.ZM17671@torch.brasslantern.com> Date: Wed, 25 Dec 2013 10:13:36 -0800 In-reply-to: <8738lhqjny.fsf@ft.bewatermyfriend.org> Comments: In reply to Frank Terbeck "Re: Bug#733075: Bug#733075: zsh: command completion not working after semicolon" (Dec 25, 12:01pm) References: <20131224214220.2173519380.qww314159@soup.q.qbilt.org> <877gatqlp3.fsf@ft.bewatermyfriend.org> <8738lhqjny.fsf@ft.bewatermyfriend.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Bug#733075: Bug#733075: zsh: command completion not working after semicolon Cc: 733075@bugs.debian.org MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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. */