From 48f0df56d24de06343bd6a52167f3f210c6c101d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 24 Oct 2014 20:03:25 -0700 Subject: Add a newline to a line that doesn't end with one. Closes #115. --- src/blocks.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/blocks.c b/src/blocks.c index 8d6fd06..bcec27a 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -460,6 +460,10 @@ static void incorporate_line(strbuf *line, int line_number, node_block** curptr) int indent; chunk input; + // Add a newline to the end if not present: + if (line->ptr[line->size - 1] != '\n') { + strbuf_putc(line, '\n'); + } input.data = line->ptr; input.len = line->size; -- cgit v1.2.3