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) (unidiff)
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
@@ -66,6 +66,8 @@ void config_cb(const char *name, const char *value)
66 ctx.cfg.index_info = xstrdup(value); 66 ctx.cfg.index_info = xstrdup(value);
67 else if (!strcmp(name, "logo-link")) 67 else if (!strcmp(name, "logo-link"))
68 ctx.cfg.logo_link = xstrdup(value); 68 ctx.cfg.logo_link = xstrdup(value);
69 else if (!strcmp(name, "linenumbers"))
70 ctx.cfg.linenumbers = atoi(value);
69 else if (!strcmp(name, "module-link")) 71 else if (!strcmp(name, "module-link"))
70 ctx.cfg.module_link = xstrdup(value); 72 ctx.cfg.module_link = xstrdup(value);
71 else if (!strcmp(name, "virtual-root")) { 73 else if (!strcmp(name, "virtual-root")) {
diff --git a/cgit.h b/cgit.h
index adb8da4..2fdc531 100644
--- a/cgit.h
+++ b/cgit.h
@@ -174,6 +174,7 @@ struct cgit_config {
174 int enable_log_filecount; 174 int enable_log_filecount;
175 int enable_log_linecount; 175 int enable_log_linecount;
176 int local_time; 176 int local_time;
177 int linenumbers;
177 int max_repo_count; 178 int max_repo_count;
178 int max_commit_count; 179 int max_commit_count;
179 int max_lock_attempts; 180 int max_lock_attempts;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 3c35b02..a762ccc 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -146,6 +146,10 @@ logo-link::
146 calculated url of the repository index page will be used. Default 146 calculated url of the repository index page will be used. Default
147 value: none. 147 value: none.
148 148
149linenumbers::
150 If set to "1" lines in tree view will have numbers.
151 Default value: "0".
152
149max-commit-count:: 153max-commit-count::
150 Specifies the number of entries to list per page in "log" view. Default 154 Specifies the number of entries to list per page in "log" view. Default
151 value: "50". 155 value: "50".
diff --git a/ui-tree.c b/ui-tree.c
index 7bf2ad2..f64e6e0 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -23,6 +23,7 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
23 23
24 html("<table summary='blob content' class='blob'>\n"); 24 html("<table summary='blob content' class='blob'>\n");
25 25
26 if (ctx.cfg.linenumbers) {
26 html("<tr><td class='linenumbers'><pre>"); 27 html("<tr><td class='linenumbers'><pre>");
27 idx = 0; 28 idx = 0;
28 lineno = 0; 29 lineno = 0;
@@ -36,6 +37,10 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
36 } 37 }
37 } 38 }
38 html("</pre></td>\n"); 39 html("</pre></td>\n");
40 }
41 else {
42 html("<tr>\n");
43 }
39 44
40 if (ctx.repo->source_filter) { 45 if (ctx.repo->source_filter) {
41 html("<td class='lines'><pre><code>"); 46 html("<td class='lines'><pre><code>");