-rw-r--r-- | ui-tree.c | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -22,21 +22,26 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size) "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n"; html("<table summary='blob content' class='blob'>\n"); - html("<tr><td class='linenumbers'><pre>"); - idx = 0; - lineno = 0; - - if (size) { - htmlf(numberfmt, ++lineno); - while(idx < size - 1) { // skip absolute last newline - if (buf[idx] == '\n') - htmlf(numberfmt, ++lineno); - idx++; + if (ctx.cfg.linenumbers) { + html("<tr><td class='linenumbers'><pre>"); + idx = 0; + lineno = 0; + + if (size) { + htmlf(numberfmt, ++lineno); + while(idx < size - 1) { // skip absolute last newline + if (buf[idx] == '\n') + htmlf(numberfmt, ++lineno); + idx++; + } } + html("</pre></td>\n"); + } + else { + html("<tr>\n"); } - html("</pre></td>\n"); if (ctx.repo->source_filter) { html("<td class='lines'><pre><code>"); ctx.repo->source_filter->argv[1] = xstrdup(name); |