From: Michael Göhler Date: Sun, 14 Sep 2014 10:31:56 +0000 (+0200) Subject: fixed nested quotation X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=5e77cd8cc9723829ce6fcd09e4a52207d6112d70;p=smdp.git fixed nested quotation --- diff --git a/viewer.c b/viewer.c index 82d8d99..15b5e6a 100644 --- a/viewer.c +++ b/viewer.c @@ -308,12 +308,17 @@ void add_line(WINDOW *window, int y, int x, line_t *line, int max_cols) { // IS_QUOTE if(CHECK_BIT(line->bits, IS_QUOTE)) { - // print a reverse color block - wattron(window, A_REVERSE); - wprintw(window, "%s", " "); - wattroff(window, A_REVERSE); - wprintw(window, "%s", " "); - offset += 2; + while(line->text->text[offset] == '>') { + // print a reverse color block + wattron(window, A_REVERSE); + wprintw(window, "%s", " "); + wattroff(window, A_REVERSE); + wprintw(window, "%s", " "); + // find next quote or break + offset++; + if(line->text->text[offset] == ' ') + offset = next_word(line->text, offset); + } } // for each char in line