From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5908 invoked by alias); 27 Aug 2015 05:14:18 -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: 36288 Received: (qmail 17353 invoked from network); 27 Aug 2015 05:14:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=JkneLRv3h0RbOPQL+AqpgQ4PA6eeSAeXcuMcVvdg+Cw=; b=JEpKTOoCAb/TuH6NYs66MzE8C92IC6f+VAbkVbt9jgJlOu6mhzwyK+AekIXg/p7JcD 64eAsEWP/PwWGSHmY7ZDOp6modp1Hcq5abDqSgqkc2bev3KglMlJVGXw0itdpZNxRKVz ljfYvNsaYutbtJdX9efuKxmthZaY60tqT/amp0Sc/1KuxJxOJdaoR+9DVGqmnu3CL9LG gB4eS3tg11/ne3CmfHWob/U6k99FjAy01ec56YBB3KN/m86QKwGqSk6T2+S3oWinz3rJ p/LwUx0jcLpZqEZ3X/+uw4+szCXKqQOkkjtomb3NOOx5cJd/6p9xgOg7kD6JK2Fbok1V wueg== X-Gm-Message-State: ALoCoQk2vMAs28XLmPB6flaQSid2JlF/eXsWXjS0MHQPpS/pAaA+xiqXjEIMzAdLX+YI6Mk9Wieo X-Received: by 10.202.77.78 with SMTP id a75mr1410108oib.32.1440652456095; Wed, 26 Aug 2015 22:14:16 -0700 (PDT) From: Bart Schaefer Message-Id: <150826221413.ZM25355@torch.brasslantern.com> Date: Wed, 26 Aug 2015 22:14:13 -0700 In-Reply-To: Comments: In reply to Mikael Magnusson "Re: Completion of prefix redirections is -command- instead of -redirect-" (Aug 27, 6:54am) References: <20150826053928.GD19027@tarsus.local2> <150826111808.ZM30185@torch.brasslantern.com> <150826213532.ZM31157@torch.brasslantern.com> <150826214729.ZM12037@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: Completion of prefix redirections is -command- instead of -redirect- MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Aug 27, 6:54am, Mikael Magnusson wrote: } } < ; gives commands (correct) This is better than 5.0.7, which gives files here. } foo < ; gives files (wrong-ish) Hasn't changed from 5.0.7. } ; < gives commands (wrong) This has changed, 5.0.7 gets it right. } foo=bar; < gives commands (wrong, presumably same case as the above) Hasn't changed since 5.0.7. } Is there any reason we can't just reset state to 'this is a new } command' when we see an unquoted solo semicolon? Or is determining } that this is the case in fact the trouble? My recollection of all of this is that it has to do with completing in the middle of for/while/repeat type constructs, where the ";" may be followed by "do" after which you have to stay in command position, or you may be in shortloops syntax, etc. But I don't recall (and likely never really understood Sven's explanation of) all the details. The below seems to make it better, the only case that is still wrong after this is "foo < ; ". But I haven't more than minimally checked that completing in e.g. "for" loops still works properly. diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index cb17bde..97bdcc0 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -1185,7 +1185,7 @@ get_comp_string(void) * relatively harmless by itself, it's probably incomplete. */ linredir = (inredir && !ins); - lincmd = !linredir && + lincmd = !inredir && ((incmdpos && !ins && !incond) || (oins == 2 && wordpos == 2) || (ins == 3 && wordpos == 1) ||