diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-10-24 20:03:25 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-10-24 20:03:25 -0700 |
commit | 48f0df56d24de06343bd6a52167f3f210c6c101d (patch) | |
tree | 337a7c71bd910d45109d3c63c48cbc5b84286cc9 | |
parent | cd231ce81f6dd7a84cfb843e9535ee260f1c30f9 (diff) |
Add a newline to a line that doesn't end with one.
Closes #115.
-rw-r--r-- | src/blocks.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |