From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11805 invoked by alias); 10 Oct 2010 17:32:41 -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: 28339 Received: (qmail 8544 invoked from network); 10 Oct 2010 17:32:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.47 as permitted sender) Date: Sun, 10 Oct 2010 18:32:19 +0100 From: Peter Stephenson To: zsh-workers@zsh.org (Zsh hackers list) Subject: Re: PATCH: another one of those Message-ID: <20101010183219.0dc0b6dd@pws-pc> In-Reply-To: <13175.1286557493@csr.com> References: <13175.1286557493@csr.com> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=DhNl2YeytwJssBBGe49HJX82LNDFEEVkpVB34RXKaPo= c=1 sm=0 a=oop4unj_LJkA:10 a=4YI7mmuYAqcA:10 a=kj9zAlcOel0A:10 a=4UtWO5riAAAA:8 a=NLZqzBF-AAAA:8 a=7xOL5VB7cUafSJffnxcA:9 a=2M0PfE3PdBpb-7sAzi4A:7 a=RG8RCJnk4OqFFcOSO3yoKjAG1HkA:4 a=CjuIK1q_8ugA:10 a=Shd8Sdw-9eQA:10 a=_dQi-Dcv4p4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Fri, 08 Oct 2010 18:04:53 +0100 Peter Stephenson wrote: > + for (;;) { > + /* > + * Not really an oddity: "\\\n" is > + * removed from input as if whitespace. > + */ > + if (inblank(*pt)) > + pt++; > + else if (strpfx("\\\n", pt)) > + pt += 2; > + else > + break; > + } I've just noticed we need to do this with NO_HIST_LEX_WORDS, too. Of course it's a guess in that case, but a pretty sensible one. Also, calling strpfx() is significant overkill for two characters in a widely used code fragment. Index: Src/hist.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hist.c,v retrieving revision 1.105 diff -p -u -r1.105 hist.c --- Src/hist.c 10 Oct 2010 17:26:39 -0000 1.105 +++ Src/hist.c 10 Oct 2010 17:28:52 -0000 @@ -2365,7 +2365,7 @@ readhistfile(char *fn, int err, int read */ if (inblank(*pt)) pt++; - else if (strpfx("\\\n", pt)) + else if (pt[0] == '\\' && pt[1] == '\n') pt += 2; else break; @@ -2414,8 +2414,14 @@ readhistfile(char *fn, int err, int read } if (!uselex) { do { - while (inblank(*pt)) - pt++; + for (;;) { + if (inblank(*pt)) + pt++; + else if (pt[0] == '\\' && pt[1] == '\n') + pt += 2; + else + break; + } if (*pt) { if (nwordpos >= nwords) words = (short *) -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/