From b590c8dbd9d50d972c656bfe62a3fe52a4f5394f Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 28 Jan 2019 15:03:41 +0100 Subject: issue #6800 Markdown line ending problems in 1.8.15 and master In case of a completely empty line with 2 spaces at the end don't consider this as a 2 space terminated line. Regression of #6448 --- src/markdown.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index fcad7e9..1b13e5c 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -1886,10 +1886,12 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) static int hasLineBreak(const char *data,int size) { int i=0; - while (i=size) return 0; // empty line if (i<2) return 0; // not long enough - return (data[i-1]==' ' && data[i-2]==' '); + return (j && data[i-1]==' ' && data[i-2]==' '); } @@ -1947,7 +1949,7 @@ void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size) out.addStr(data,size); if (hasLineBreak(data,size)) { - out.addStr("\n"); + out.addStr("
"); } } } -- cgit v0.12 From cc50cc2466d832c6b3018118450afa92dee4b03d Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Thu, 31 Jan 2019 20:39:16 +0100 Subject: Minor tweaks --- src/markdown.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index 1b13e5c..93a4c91 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -1887,11 +1887,15 @@ static int hasLineBreak(const char *data,int size) { int i=0; int j=0; - /* search for end of line and also check if it is not a completely empty, i.e. only spaces or tabs, line is */ - while (i=size) return 0; // empty line if (i<2) return 0; // not long enough - return (j && data[i-1]==' ' && data[i-2]==' '); + return (j>0 && data[i-1]==' ' && data[i-2]==' '); // non blank line with at two spaces at the end } -- cgit v0.12