From: Michael Göhler Date: Thu, 6 Nov 2014 22:47:34 +0000 (+0100) Subject: fixed other valgrind read error, ugly but works :) X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=0b0a025d81ad8f9caed6c945dbcb1a18ce38b300;p=smdp.git fixed other valgrind read error, ugly but works :) --- diff --git a/src/viewer.c b/src/viewer.c index df66fd5..574c3a0 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -612,10 +612,11 @@ void inline_display(WINDOW *window, const char *c, const int colors) { // emphasis or code span can start after new-line or space only // and of cause after another emphasis markup - if(*(i - 1) == ' ' || - ((*(i - 1) == '_' || *(i - 1) == '*') && (*(i - 2) == ' ' || (i - 1) == c)) || - *i == '\\' || - i == c) { + //TODO this condition looks ugly + if(i == c || + *(i - 1) == ' ' || + ((i + 1 > c) && (*(i - 1) == '_' || *(i - 1) == '*') && (*(i - 2) == ' ' || (i - 1) == c)) || + *i == '\\') { switch(*i) { // enable highlight