From 0b0a025d81ad8f9caed6c945dbcb1a18ce38b300 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20G=C3=B6hler?= Date: Thu, 6 Nov 2014 23:47:34 +0100 Subject: [PATCH] fixed other valgrind read error, ugly but works :) --- src/viewer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 -- 2.20.1