X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=parser.c;h=33466347ed89bb85cd726d4883cf93dc03557619;hb=f92a7609f7b4a6c72a892b16d371528213eca283;hp=3b56b5b347ca8a12c3fdc66db5e9be999934cbc8;hpb=66f6ce722f0d763efbf66ca6f8a958bc75ab854e;p=smdp.git diff --git a/parser.c b/parser.c index 3b56b5b..3346634 100644 --- a/parser.c +++ b/parser.c @@ -81,7 +81,7 @@ deck_t *markdown_load(FILE *input) { } else if(c == '\t') { // expand tab to spaces - for (i = 0; i <= EXPAND_TABS; i++) { + for (i = 0; i < EXPAND_TABS; i++) { (text->expand)(text, ' '); l++; } @@ -172,7 +172,8 @@ deck_t *markdown_load(FILE *input) { // remove line from linked list line->prev->next = line->next; - line->next->prev = line->prev; + if(line->next) + line->next->prev = line->prev; // set bits on revious line if(CHECK_BIT(line->bits, IS_H1)) { @@ -369,3 +370,7 @@ int next_blank(cstring_t *text, int i) { return i; } +int next_word(cstring_t *text, int i) { + return next_nonblank(text, next_blank(text, i)); +} +