summaryrefslogtreecommitdiff
path: root/ui-tree.c
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2009-08-09 20:42:45 +0000
committerLars Hjemli <hjemli@gmail.com>2009-08-21 12:17:49 +0000
commitd67cc7f9d556650438e421cdcda37bc52710bffd (patch)
treedf131c58de7c712550f124f8fb15aef303ff6054 /ui-tree.c
parent03389d6e67bfda5cb3ff1504db815f09715ec6f4 (diff)
downloadcgit-d67cc7f9d556650438e421cdcda37bc52710bffd.tar
cgit-d67cc7f9d556650438e421cdcda37bc52710bffd.tar.gz
cgit-d67cc7f9d556650438e421cdcda37bc52710bffd.zip
Add 'linenumbers' config option
Signed-off-by: Florian Pritz <bluewind@xssn.at> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 7bf2ad2..f64e6e0 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -23,19 +23,24 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
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>");