From 5e77cd8cc9723829ce6fcd09e4a52207d6112d70 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Michael=20G=C3=B6hler?= <somebody.here@gmx.de>
Date: Sun, 14 Sep 2014 12:31:56 +0200
Subject: [PATCH] fixed nested quotation

---
 viewer.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

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
-- 
2.20.1