This fixes a couple of minor oversights in previous commits and adjusts all cells using colspan to use the correct width.
Unified · Split
| @@ -98,14 +98,14 @@ next: · 97 unmodified lines | ||
| 98 | 98 | static void print_commit(struct commit *commit, struct rev_info *revs) |
| 99 | 99 | { |
| 100 | 100 | struct commitinfo *info; |
| 101 | − int cols = revs->graph ? 3 : 2; | |
| 101 | + int columns = revs->graph ? 4 : 3; | |
| 102 | 102 | struct strbuf graphbuf = STRBUF_INIT; |
| 103 | 103 | struct strbuf msgbuf = STRBUF_INIT; |
| 104 | 104 | |
| 105 | 105 | if (ctx.repo->enable_log_filecount) |
| 106 | − cols++; | |
| 106 | + columns++; | |
| 107 | 107 | if (ctx.repo->enable_log_linecount) |
| 108 | − cols++; | |
| 108 | + columns++; | |
| 109 | 109 | |
| 110 | 110 | if (revs->graph) { |
| 111 | 111 | /* Advance graph until current commit */ |
| @@ -113,7 +113,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) · 1 unmodified line | ||
| 113 | 113 | /* Print graph segment in otherwise empty table row */ |
| 114 | 114 | html("<tr class='nohover'><td class='commitgraph'>"); |
| 115 | 115 | html(graphbuf.buf); |
| 116 | − htmlf("</td><td colspan='%d' /></tr>\n", cols); | |
| 116 | + htmlf("</td><td colspan='%d' /></tr>\n", columns); | |
| 117 | 117 | strbuf_setlen(&graphbuf, 0); |
| 118 | 118 | } |
| 119 | 119 | /* Current commit's graph segment is now ready in graphbuf */ |
| @@ -232,7 +232,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) · 112 unmodified lines | ||
| 232 | 232 | html("<td/>"); /* Empty 'Age' column */ |
| 233 | 233 | |
| 234 | 234 | /* Print msgbuf into remainder of table row */ |
| 235 | − htmlf("<td colspan='%d'%s>\n", cols, | |
| 235 | + htmlf("<td colspan='%d'%s>\n", columns - (revs->graph ? 1 : 0), | |
| 236 | 236 | ctx.qry.showmsg ? " class='logmsg'" : ""); |
| 237 | 237 | html_txt(msgbuf.buf); |
| 238 | 238 | html("</td></tr>\n"); |
| @@ -283,7 +283,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern · 44 unmodified lines | ||
| 283 | 283 | struct rev_info rev; |
| 284 | 284 | struct commit *commit; |
| 285 | 285 | struct vector vec = VECTOR_INIT(char *); |
| 286 | − int i, columns = 3; | |
| 286 | + int i, columns = commit_graph ? 4 : 3; | |
| 287 | 287 | char *arg; |
| 288 | 288 | |
| 289 | 289 | /* First argv is NULL */ |
| @@ -421,7 +421,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern · 131 unmodified lines | ||
| 421 | 421 | } |
| 422 | 422 | html("</div>"); |
| 423 | 423 | } else if ((commit = get_revision(&rev)) != NULL) { |
| 424 | − html("<tr class='nohover'><td colspan='3'>"); | |
| 424 | + htmlf("<tr class='nohover'><td colspan='%d'>", columns); | |
| 425 | 425 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, |
| 426 | 426 | ctx.qry.vpath, 0, NULL, NULL, ctx.qry.showmsg); |
| 427 | 427 | html("</td></tr>\n"); |
| @@ -177,7 +177,7 @@ static int print_tag(struct refinfo *ref) · 176 unmodified lines | ||
| 177 | 177 | |
| 178 | 178 | static void print_refs_link(char *path) |
| 179 | 179 | { |
| 180 | − html("<tr class='nohover'><td colspan='4'>"); | |
| 180 | + html("<tr class='nohover'><td colspan='5'>"); | |
| 181 | 181 | cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path); |
| 182 | 182 | html("</td></tr>"); |
| 183 | 183 | } |
| @@ -252,7 +252,7 @@ void cgit_print_refs() · 68 unmodified lines | ||
| 252 | 252 | cgit_print_tags(0); |
| 253 | 253 | else { |
| 254 | 254 | cgit_print_branches(0); |
| 255 | − html("<tr class='nohover'><td colspan='4'> </td></tr>"); | |
| 255 | + html("<tr class='nohover'><td colspan='5'> </td></tr>"); | |
| 256 | 256 | cgit_print_tags(0); |
| 257 | 257 | } |
| 258 | 258 | html("</table>"); |
| @@ -17,15 +17,22 @@ int urls = 0; · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | static void print_url(char *base, char *suffix) |
| 19 | 19 | { |
| 20 | + int columns = 3; | |
| 21 | + | |
| 22 | + if (ctx.repo->enable_log_filecount) | |
| 23 | + columns++; | |
| 24 | + if (ctx.repo->enable_log_linecount) | |
| 25 | + columns++; | |
| 26 | + | |
| 20 | 27 | if (!base || !*base) |
| 21 | 28 | return; |
| 22 | 29 | if (urls++ == 0) { |
| 23 | − html("<tr class='nohover'><td colspan='4'> </td></tr>"); | |
| 24 | − html("<tr><th class='left' colspan='4'>Clone</th></tr>\n"); | |
| 30 | + htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); | |
| 31 | + htmlf("<tr><th class='left' colspan='%d'>Clone</th></tr>\n", columns); | |
| 25 | 32 | } |
| 26 | 33 | if (suffix && *suffix) |
| 27 | 34 | base = fmt("%s/%s", base, suffix); |
| 28 | − html("<tr><td colspan='4'><a href='"); | |
| 35 | + htmlf("<tr><td colspan='%d'><a href='", columns); | |
| 29 | 36 | html_url_path(base); |
| 30 | 37 | html("'>"); |
| 31 | 38 | html_txt(base); |
| @@ -52,12 +59,19 @@ static void print_urls(char *txt, char *suffix) · 20 unmodified lines | ||
| 52 | 59 | |
| 53 | 60 | void cgit_print_summary() |
| 54 | 61 | { |
| 62 | + int columns = 3; | |
| 63 | + | |
| 64 | + if (ctx.repo->enable_log_filecount) | |
| 65 | + columns++; | |
| 66 | + if (ctx.repo->enable_log_linecount) | |
| 67 | + columns++; | |
| 68 | + | |
| 55 | 69 | html("<table summary='repository info' class='list nowrap'>"); |
| 56 | 70 | cgit_print_branches(ctx.cfg.summary_branches); |
| 57 | − html("<tr class='nohover'><td colspan='4'> </td></tr>"); | |
| 71 | + htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); | |
| 58 | 72 | cgit_print_tags(ctx.cfg.summary_tags); |
| 59 | 73 | if (ctx.cfg.summary_log > 0) { |
| 60 | − html("<tr class='nohover'><td colspan='4'> </td></tr>"); | |
| 74 | + htmlf("<tr class='nohover'><td colspan='%d'> </td></tr>", columns); | |
| 61 | 75 | cgit_print_log(ctx.qry.head, 0, ctx.cfg.summary_log, NULL, |
| 62 | 76 | NULL, NULL, 0, 0, 0); |
| 63 | 77 | } |