summaryrefslogtreecommitdiffabout
authorFlorian Pritz <bluewind@xssn.at>2009-08-09 20:42:45 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-08-21 12:17:49 (UTC)
commitd67cc7f9d556650438e421cdcda37bc52710bffd (patch) (side-by-side diff)
treedf131c58de7c712550f124f8fb15aef303ff6054
parent03389d6e67bfda5cb3ff1504db815f09715ec6f4 (diff)
downloadcgit-d67cc7f9d556650438e421cdcda37bc52710bffd.zip
cgit-d67cc7f9d556650438e421cdcda37bc52710bffd.tar.gz
cgit-d67cc7f9d556650438e421cdcda37bc52710bffd.tar.bz2
Add 'linenumbers' config option
Signed-off-by: Florian Pritz <bluewind@xssn.at> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h1
-rw-r--r--cgitrc.5.txt4
-rw-r--r--ui-tree.c5
4 files changed, 12 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index b0e1c44..a4788cb 100644
--- a/cgit.c
+++ b/cgit.c
@@ -68,2 +68,4 @@ void config_cb(const char *name, const char *value)
ctx.cfg.logo_link = xstrdup(value);
+ else if (!strcmp(name, "linenumbers"))
+ ctx.cfg.linenumbers = atoi(value);
else if (!strcmp(name, "module-link"))
diff --git a/cgit.h b/cgit.h
index adb8da4..2fdc531 100644
--- a/cgit.h
+++ b/cgit.h
@@ -176,2 +176,3 @@ struct cgit_config {
int local_time;
+ int linenumbers;
int max_repo_count;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 3c35b02..a762ccc 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -148,2 +148,6 @@ logo-link::
+linenumbers::
+ If set to "1" lines in tree view will have numbers.
+ Default value: "0".
+
max-commit-count::
diff --git a/ui-tree.c b/ui-tree.c
index 7bf2ad2..f64e6e0 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -25,2 +25,3 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
+ if (ctx.cfg.linenumbers) {
html("<tr><td class='linenumbers'><pre>");
@@ -38,2 +39,6 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
html("</pre></td>\n");
+ }
+ else {
+ html("<tr>\n");
+ }