From 974c195ed76cf7a173fc926113b3ae10a4d88a1d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Tue, 15 Sep 2026 21:02:45 -1000 Subject: Keep the hash rows out of the column widths --- assets/cgit.css | 10 ++++++++++ source/ui-commit.c | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/assets/cgit.css b/assets/cgit.css index 462c4ae..511c377 100644 --- a/assets/cgit.css +++ b/assets/cgit.css @@ -821,6 +821,11 @@ div#cgit table.commit-info td { padding: 0.1em 1em 0.1em 0.1em; } +div#cgit table.commit-info div.spanning { + width: 0; + white-space: nowrap; +} + div#cgit div.commit-subject { font-weight: bold; font-size: 125%; @@ -1375,4 +1380,9 @@ div#cgit table.ssdiff td.space { div#cgit table.commit-info { width: 100%; } + + div#cgit table.commit-info div.spanning { + width: auto; + white-space: normal; + } } diff --git a/source/ui-commit.c b/source/ui-commit.c index ba079a0..80c7faf 100644 --- a/source/ui-commit.c +++ b/source/ui-commit.c @@ -61,14 +61,14 @@ static int print_parent_rows(struct commit *commit, const char *rev, const char html("\n"); continue; } - html("parent"); + html("parent
"); parent_hex = label = oid_to_hex(&p->item->object.oid); if (ctx.repo->enable_subject_links) label = cgit_parse_commit(parent)->subject; cgit_commit_link(label, NULL, NULL, ctx.qry.head, parent_hex, prefix); html(" ("); cgit_diff_link("diff", NULL, NULL, ctx.qry.head, rev, oid_to_hex(&p->item->object.oid), prefix); - html(")\n"); + html(")
\n"); parents++; } return parents; @@ -260,18 +260,20 @@ void cgit_print_commit(char *hex, const char *prefix) print_ident_row("committer", info->committer, info->committer_email, info->committer_date, info->committer_tz); - html("commit"); + // The spanning cells are kept out of the column widths, so a hash row + // never pushes the dates away from the names above it. + html("commit
"); commit_hex = oid_to_hex(&commit->object.oid); cgit_commit_link(commit_hex, NULL, NULL, ctx.qry.head, commit_hex, prefix); html(" ("); cgit_patch_link("patch", NULL, NULL, NULL, commit_hex, prefix); - html(")\n"); + html(")
\n"); // The parent rows follow the commit row so the commit hashes sit // together, leaving the tree beside the download links. parents = print_parent_rows(commit, hex, prefix); - html("tree"); + html("tree
"); tree_rev = xstrdup(hex); cgit_tree_link(oid_to_hex(get_commit_tree_oid(commit)), NULL, NULL, ctx.qry.head, tree_rev, NULL); if (prefix) { @@ -279,12 +281,12 @@ void cgit_print_commit(char *hex, const char *prefix) cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tree_rev, prefix); } free(tree_rev); - html("\n"); + html("
\n"); if (ctx.repo->snapshots) { - html("download"); + html("download
"); cgit_print_snapshot_links(ctx.repo, hex, "
"); - html("\n"); + html("
\n"); } html("\n"); -- cgit v2.8.0