mirror of
https://git.zx2c4.com/cgit
synced 2025-08-29 06:08:24 +02:00
Add 'linenumbers' config option
Signed-off-by: Florian Pritz <bluewind@xssn.at> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
03389d6e67
commit
d67cc7f9d5
4 changed files with 23 additions and 11 deletions
27
ui-tree.c
27
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>");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue