zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org (Zsh hackers list)
Subject: Re: PATCH: another one of those
Date: Sun, 10 Oct 2010 18:32:19 +0100	[thread overview]
Message-ID: <20101010183219.0dc0b6dd@pws-pc> (raw)
In-Reply-To: <13175.1286557493@csr.com>

On Fri, 08 Oct 2010 18:04:53 +0100
Peter Stephenson <pws@csr.com> 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 <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


      reply	other threads:[~2010-10-10 17:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-08 17:04 Peter Stephenson
2010-10-10 17:32 ` Peter Stephenson [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=20101010183219.0dc0b6dd@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --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).