aboutsummaryrefslogtreecommitdiff
path: root/ui-tree.c
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/ui-tree.c b/ui-tree.c
index c26ba4c..4bf372a 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -18,8 +18,8 @@ static void print_object(const unsigned char *sha1, char *path)
{
enum object_type type;
char *buf;
- unsigned long size, lineno, idx;
- const char *numberfmt = "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n";
+ unsigned long size, lineno, start, idx;
+ const char *linefmt = "<tr><td class='no'><a id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a></td><td class='txt'>";
type = sha1_object_info(sha1, &size);
if (type == OBJ_BAD) {
@@ -38,28 +38,27 @@ static void print_object(const unsigned char *sha1, char *path)
html(" (");
cgit_plain_link("plain", NULL, NULL, ctx.qry.head,
curr_rev, path);
- htmlf(")<br/>blob: %s\n", sha1_to_hex(sha1));
+ htmlf(")<br/>blob: %s", sha1_to_hex(sha1));
html("<table summary='blob content' class='blob'>\n");
- html("<tr>\n");
-
- html("<td class='linenumbers'><pre>");
idx = 0;
+ start = 0;
lineno = 0;
- htmlf(numberfmt, ++lineno);
- while(idx < size - 1) { // skip absolute last newline
+ while(idx < size) {
if (buf[idx] == '\n') {
- htmlf(numberfmt, ++lineno);
+ buf[idx] = '\0';
+ htmlf(linefmt, ++lineno);
+ html_txt(buf + start);
+ html("</td></tr>\n");
+ start = idx + 1;
}
idx++;
}
- html("</pre></td>\n");
-
- html("<td class='lines'><pre><code>");
- html_txt(buf);
- html("</code></pre></td>\n");
-
- html("</tr>\n");
+ if (start < idx) {
+ htmlf(linefmt, ++lineno);
+ html_txt(buf + start);
+ }
+ html("</td></tr>\n");
html("</table>\n");
}
@@ -109,10 +108,7 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
html("<td>");
cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,
- fullpath, 0, NULL, NULL, ctx.qry.showmsg);
- if (ctx.repo->max_stats)
- cgit_stats_link("stats", NULL, "button", ctx.qry.head,
- fullpath);
+ fullpath, 0, NULL, NULL);
html("</td></tr>\n");
free(name);
return 0;