From da7d5e6c19b3eff93483746e3e111d2ddf7343f8 Mon Sep 17 00:00:00 2001 From: Damien Tardy-Panis Date: Tue, 19 May 2020 18:19:49 +0200 Subject: [PATCH] Fix parsing of line breaks without newline --- src/main.c | 2 +- test/line-breaks | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 603c91e..08bf384 100644 --- a/src/main.c +++ b/src/main.c @@ -186,8 +186,8 @@ static void parse_linebreak(struct parser *p) { uint32_t lf = parser_getch(p); if (lf != '\n') { fprintf(p->output, "+"); + parser_pushch(p, lf); parser_pushch(p, plus); - parser_pushch(p, '\n'); return; } uint32_t ch = parser_getch(p); diff --git a/test/line-breaks b/test/line-breaks index c6c2fc4..e97332f 100755 --- a/test/line-breaks +++ b/test/line-breaks @@ -27,3 +27,11 @@ test(8) hello+world EOF end 0 + +begin "Leave double + without newline" +scdoc </dev/null +test(8) + +hello++world +EOF +end 0