author | Lars Hjemli <hjemli@gmail.com> | 2008-11-29 17:58:31 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-11-29 17:58:31 (UTC) |
commit | 951f550b60befeacd7334aebd64c891e72be5ac4 (patch) (side-by-side diff) | |
tree | 334c9bff80857a27a0daca9a0f78c760bb4be6f3 /ui-log.c | |
parent | 0274b57d55a12ed38259757dbfae96b79cfa2e0b (diff) | |
download | cgit-951f550b60befeacd7334aebd64c891e72be5ac4.zip cgit-951f550b60befeacd7334aebd64c891e72be5ac4.tar.gz cgit-951f550b60befeacd7334aebd64c891e72be5ac4.tar.bz2 |
ui-log: (ab)use extra columns for commit message when showmsg=1
If the commit message has extra long lines it's better to use the author/
files/lines columns to show those lines than to push the columns of screen
and force the users to hscroll.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-log.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -14,88 +14,89 @@ int files, add_lines, rem_lines; void count_lines(char *line, int size) { if (size <= 0) return; if (line[0] == '+') add_lines++; else if (line[0] == '-') rem_lines++; } void inspect_files(struct diff_filepair *pair) { files++; if (ctx.repo->enable_log_linecount) cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); } void print_commit(struct commit *commit) { struct commitinfo *info; char *tmp; + int cols = 2; info = cgit_parse_commit(commit); html("<tr><td>"); tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); html_link_open(tmp, NULL, NULL); cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); html_link_close(); html("</td><td>"); if (ctx.qry.showmsg) html("<u>"); cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, sha1_to_hex(commit->object.sha1)); if (ctx.qry.showmsg) html("</u>"); html("</td><td>"); html_txt(info->author); if (ctx.repo->enable_log_filecount) { files = 0; add_lines = 0; rem_lines = 0; cgit_diff_commit(commit, inspect_files); html("</td><td>"); htmlf("%d", files); if (ctx.repo->enable_log_linecount) { html("</td><td>"); htmlf("-%d/+%d", rem_lines, add_lines); } } html("</td></tr>\n"); if (ctx.qry.showmsg) { - html("<tr class='nohover'><td></td><td><div class='commit-msg'>"); - html_txt(info->msg); - html("</div><br/></td><td></td>"); if (ctx.repo->enable_log_filecount) { - html("<td></td>"); + cols++; if (ctx.repo->enable_log_linecount) - html("<td></td>"); + cols++; } - html("</tr>\n"); + htmlf("<tr class='nohover'><td></td><td colspan='%d'><div class='commit-msg'>", + cols); + html_txt(info->msg); + html("</div><br/></td></tr>\n"); } cgit_free_commitinfo(info); } void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager) { struct rev_info rev; struct commit *commit; const char *argv[] = {NULL, tip, NULL, NULL, NULL}; int argc = 2; int i, columns = 3; if (!tip) argv[1] = ctx.qry.head; if (grep && pattern && (!strcmp(grep, "grep") || !strcmp(grep, "author") || !strcmp(grep, "committer"))) argv[argc++] = fmt("--%s=%s", grep, pattern); if (path) { argv[argc++] = "--"; |