History

ui-tree.c: show line numbers when highlighting

When source-filter is enabled, cgit currently will not display linenumbers in the tree view. This patch restores the linenumber function.

Florian Pritz committed 17 years ago

Commit 03389d61 parent 6445a3a1 file · +11 −9Browse files

Unified · Split

ui-tree.c+11−9
@@ -22,15 +22,6 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size) · 21 unmodified lines
2222 "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n";
2323
2424 html("<table summary='blob content' class='blob'>\n");
25− if (ctx.repo->source_filter) {
26− html("<tr><td class='lines'><pre><code>");
27− ctx.repo->source_filter->argv[1] = xstrdup(name);
28− cgit_open_filter(ctx.repo->source_filter);
29− write(STDOUT_FILENO, buf, size);
30− cgit_close_filter(ctx.repo->source_filter);
31− html("</code></pre></td></tr></table>\n");
32− return;
33− }
3425
3526 html("<tr><td class='linenumbers'><pre>");
3627 idx = 0;
@@ -45,6 +36,17 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size) · 8 unmodified lines
4536 }
4637 }
4738 html("</pre></td>\n");
39+
40+ if (ctx.repo->source_filter) {
41+ html("<td class='lines'><pre><code>");
42+ ctx.repo->source_filter->argv[1] = xstrdup(name);
43+ cgit_open_filter(ctx.repo->source_filter);
44+ write(STDOUT_FILENO, buf, size);
45+ cgit_close_filter(ctx.repo->source_filter);
46+ html("</code></pre></td></tr></table>\n");
47+ return;
48+ }
49+
4850 html("<td class='lines'><pre><code>");
4951 html_txt(buf);
5052 html("</code></pre></td></tr></table>\n");