diff options
Diffstat (limited to '')
-rw-r--r--source/ui-log.c27
1 file changed, 21 insertions, 6 deletions
diff --git a/source/ui-log.c b/source/ui-log.c
index 98efcf6..2812246 100644
--- a/source/ui-log.c
+++ b/source/ui-log.c
@@ -212,7 +212,15 @@ static void print_graph_padding(struct rev_info *revs, struct strbuf *graph, int
html("</td>\n");
}
-static void print_commit(struct commit *commit, struct rev_info *revs)
+// Ends a row in a table wider than the log with an empty cell for each column
+// the log has no use for.
+static void print_filler(int columns)
+{
+ while (columns-- > 0)
+ html("<td></td>");
+}
+
+static void print_commit(struct commit *commit, struct rev_info *revs, int filler)
{
struct commitinfo *info;
int columns = revs->graph ? 4 : 3;
@@ -223,6 +231,8 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
columns++;
if (ctx.repo->enable_log_linecount)
columns++;
+ // The rows that span the table reach across the filler as well.
+ columns += filler;
if (revs->graph)
print_graph_above(revs, &graphbuf, columns);
@@ -270,7 +280,9 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
htmlf("</td><td class='col-count'><span class='deletions'>-%d</span>/"
"<span class='insertions'>+%d</span>", removed_lines, added_lines);
- html("</td></tr>\n");
+ html("</td>");
+ print_filler(filler);
+ html("</tr>\n");
if ((revs->graph && !graph_is_commit_finished(revs->graph)) || ctx.qry.showmsg) {
html("<tr class='nohover-highlight'>");
@@ -449,12 +461,12 @@ void cgit_print_commit_decorations(struct commit *commit)
}
void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
- const char *path, int pager, int commit_graph, int commit_sort)
+ const char *path, int pager, int commit_graph, int commit_sort, int table_columns)
{
struct rev_info rev;
struct commit *commit;
struct strvec rev_argv = STRVEC_INIT;
- int i, columns = commit_graph ? 4 : 3;
+ int i, columns = commit_graph ? 4 : 3, filler = 0;
int must_free_tip = 0;
// setup_revisions skips the first entry the way a command skips its
@@ -591,6 +603,9 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
html("<th class='left col-count' scope='col'>Lines</th>");
columns++;
}
+ if (table_columns > columns)
+ filler = table_columns - columns;
+ print_filler(filler);
html("</tr>\n");
if (ofs < 0)
@@ -609,7 +624,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
counts_ready = 0;
if (should_show(commit, &rev)) {
i++;
- print_commit(commit, &rev);
+ print_commit(commit, &rev, filler);
}
release_commit_memory(the_repository->parsed_objects, commit);
commit->parents = NULL;
@@ -619,7 +634,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
cgit_print_layout_end();
} else {
if (get_revision(&rev)) {
- htmlf("<tr class='nohover'><td colspan='%d'>", columns);
+ htmlf("<tr class='nohover'><td colspan='%d'>", columns + filler);
cgit_log_link(
"[...]", NULL, NULL, ctx.qry.head, NULL, ctx.qry.vpath, 0,
NULL, NULL, ctx.qry.showmsg, ctx.qry.follow