* PATCH: another one of those
@ 2010-10-08 17:04 Peter Stephenson
2010-10-10 17:32 ` Peter Stephenson
0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2010-10-08 17:04 UTC (permalink / raw)
To: Zsh hackers list
Index: Src/hist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/hist.c,v
retrieving revision 1.104
diff -p -u -r1.104 hist.c
--- Src/hist.c 7 Oct 2010 16:49:50 -0000 1.104
+++ Src/hist.c 8 Oct 2010 17:04:13 -0000
@@ -2358,8 +2358,18 @@ readhistfile(char *fn, int err, int read
incnode(wordnode)) {
char *word = getdata(wordnode);
- while (inblank(*pt))
- pt++;
+ 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;
+ }
if (!strpfx(word, pt)) {
int bad = 0;
/*
--
Peter Stephenson <pws@csr.com> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: another one of those
2010-10-08 17:04 PATCH: another one of those Peter Stephenson
@ 2010-10-10 17:32 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2010-10-10 17:32 UTC (permalink / raw)
To: Zsh hackers list
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/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-10 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-08 17:04 PATCH: another one of those Peter Stephenson
2010-10-10 17:32 ` Peter Stephenson
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).