cgit

commit 951f550b60befeacd7334aebd64c891e72be5ac4

Author: Lars Hjemli <hjemli@gmail.com>

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>

 ui-log.c | 13 +++++++------


diff --git a/ui-log.c b/ui-log.c
index 631e46da94509a833b5305a9c6b14e13744e7b00..adc9a66a5ddc673b6e13171efa735fd2aa95614f 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -35,6 +35,7 @@ void print_commit(struct commit *commit)
 {
 	struct commitinfo *info;
 	char *tmp;
+	int cols = 2;
 
 	info = cgit_parse_commit(commit);
 	html("<tr><td>");
@@ -66,15 +67,15 @@ 		}
 	}
 	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);
 }