summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ui-tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ui-tree.c b/ui-tree.c
index c6159ec..553dbaa 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -25,12 +25,15 @@ static void print_text_buffer(char *buf, unsigned long size)
25 html("<tr><td class='linenumbers'><pre>"); 25 html("<tr><td class='linenumbers'><pre>");
26 idx = 0; 26 idx = 0;
27 lineno = 0; 27 lineno = 0;
28
29 if (size) {
28 htmlf(numberfmt, ++lineno); 30 htmlf(numberfmt, ++lineno);
29 while(idx < size - 1) { // skip absolute last newline 31 while(idx < size - 1) { // skip absolute last newline
30 if (buf[idx] == '\n') 32 if (buf[idx] == '\n')
31 htmlf(numberfmt, ++lineno); 33 htmlf(numberfmt, ++lineno);
32 idx++; 34 idx++;
33 } 35 }
36 }
34 html("</pre></td>\n"); 37 html("</pre></td>\n");
35 html("<td class='lines'><pre><code>"); 38 html("<td class='lines'><pre><code>");
36 html_txt(buf); 39 html_txt(buf);