Diff options
Diffstat (limited to '')
| -rw-r--r-- | source/ui-ssdiff.c | 11 |
1 file changed, 7 insertions, 4 deletions
diff --git a/source/ui-ssdiff.c b/source/ui-ssdiff.c index afa25ea..75f8185 100644 --- a/source/ui-ssdiff.c +++ b/source/ui-ssdiff.c @@ -21,6 +21,8 @@ struct deferred_line { struct deferred_line *next; }; +// The pair being rendered, whose two sides the line number links lead into. +static struct diff_filepair *current_filepair; static int current_old_line, current_new_line; static int **lcs_table; static struct deferred_line *deferred_old, *deferred_old_last; @@ -196,7 +198,7 @@ static void print_row(const char *class, int old_line_no, char *old_line, lcs = longest_common_subsequence(old_line, new_line); html("<tr>\n"); if (old_line_no > 0) { - print_lineno_cell(cgit_get_current_old_file(), old_rev_oid, old_line_no); + print_lineno_cell(current_filepair->one, old_rev_oid, old_line_no); htmlf("<td class='%s'>", class); } else if (old_line) { htmlf("<td class='lineno'></td><td class='%s'>", class); @@ -212,7 +214,7 @@ static void print_row(const char *class, int old_line_no, char *old_line, html("</td>\n"); if (new_line_no > 0) { - print_lineno_cell(cgit_get_current_new_file(), new_rev_oid, new_line_no); + print_lineno_cell(current_filepair->two, new_rev_oid, new_line_no); htmlf("<td class='%s'>", class); } else if (new_line) { htmlf("<td class='lineno'></td><td class='%s'>", class); @@ -401,12 +403,13 @@ void cgit_ssdiff_line_cb(char *line, int len) line[len - 1] = terminator; } -void cgit_ssdiff_header_begin(const char *path) +void cgit_ssdiff_header_begin(struct diff_filepair *pair) { + current_filepair = pair; current_old_line = -1; current_new_line = -1; html("<tbody class='file' data-path='"); - html_attr(path); + html_attr(pair->two->path); html("'>\n"); html("<tr><td class='space' colspan='4'></td></tr>\n"); html("<tr><td class='head' colspan='4'>"); |
