From 9941105a84a54a25e023cddd981b3ad81e53bbbf Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 14 Aug 2026 09:30:38 -1000 Subject: Let the listings wrap and the diff tables scroll --- assets/cgit.css | 29 +++++++++++++++++++---------- source/ui-diff.c | 2 ++ source/ui-empty.c | 4 ++-- source/ui-log.c | 2 +- source/ui-refs.c | 2 +- source/ui-repolist.c | 2 +- source/ui-summary.c | 4 ++-- source/ui-tag.c | 2 +- 8 files changed, 29 insertions(+), 18 deletions(-) diff --git a/assets/cgit.css b/assets/cgit.css index 3161102..6c1ada4 100644 --- a/assets/cgit.css +++ b/assets/cgit.css @@ -271,6 +271,9 @@ div#cgit #header h1.main { font-size: 250%; font-weight: normal; white-space: nowrap; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; } div#cgit #header h1.main a { @@ -436,6 +439,16 @@ div#cgit table.list td { padding: 0.3em 0.6em 0.3em 0.6em; } +div#cgit table.list td.col-author, +div#cgit table.list td.col-count, +div#cgit table.list td.col-links { + white-space: nowrap; +} + +div#cgit table.list td.clone-url { + overflow-wrap: anywhere; +} + div#cgit table.list td.commitgraph { font-family: var(--font-mono); white-space: pre; @@ -839,10 +852,6 @@ div#cgit table.bin-blob td { /* Commit / tag */ -div#cgit table.nowrap td { - white-space: nowrap; -} - div#cgit table.commit-info { border-collapse: collapse; margin-top: 1.5em; @@ -885,7 +894,6 @@ div#cgit table.commit-info th { div#cgit table.commit-info td { font-weight: normal; padding: 0.1em 1em 0.1em 0.1em; - overflow-wrap: anywhere; } div#cgit div.commit-subject { @@ -1000,6 +1008,12 @@ div#cgit div.diffstat-summary { /* Unified diff */ +/* A scroll box beside the options float would shrink to fit the gap. */ +div#cgit div.diff-scroll { + clear: right; + overflow-x: auto; +} + div#cgit table.diff { width: 100%; } @@ -1427,7 +1441,6 @@ div#cgit table.ssdiff td.space div { div#cgit #header h1.main { white-space: normal; overflow-wrap: anywhere; - min-width: 0; font-size: 190%; } @@ -1453,10 +1466,6 @@ div#cgit table.ssdiff td.space div { div#cgit table.commit-info { width: 100%; } - - div#cgit table.nowrap td { - white-space: normal; - } } @media (max-width: 380px) { diff --git a/source/ui-diff.c b/source/ui-diff.c index 09e2790..f0ad58a 100644 --- a/source/ui-diff.c +++ b/source/ui-diff.c @@ -707,6 +707,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, return; } + html("
"); if (use_ssdiff) { html(""); } else { @@ -727,6 +728,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, if (!use_ssdiff) html(""); html("
"); + html("
"); if (show_ctrls) cgit_print_layout_end(); diff --git a/source/ui-empty.c b/source/ui-empty.c index 56ca6e1..b5f90fc 100644 --- a/source/ui-empty.c +++ b/source/ui-empty.c @@ -13,7 +13,7 @@ static void print_clone_url(const char *url) { - html(""); + html(""); html("\n"); cgit_add_clone_urls(print_clone_url); html("
Clone
\n"); diff --git a/source/ui-log.c b/source/ui-log.c index f80ed16..4bd17fa 100644 --- a/source/ui-log.c +++ b/source/ui-log.c @@ -536,7 +536,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, if (pager) { cgit_print_layout_start(); - html(""); + html("
"); } html(""); diff --git a/source/ui-refs.c b/source/ui-refs.c index d179cdf..9897839 100644 --- a/source/ui-refs.c +++ b/source/ui-refs.c @@ -332,7 +332,7 @@ void cgit_print_tags(int maxcount) void cgit_print_refs(void) { cgit_print_layout_start(); - html("
"); + html("
"); if (ctx.qry.path && starts_with(ctx.qry.path, "heads")) print_branches_page(ctx.cfg.max_ref_count); diff --git a/source/ui-repolist.c b/source/ui-repolist.c index 3bdae37..e9e710e 100644 --- a/source/ui-repolist.c +++ b/source/ui-repolist.c @@ -420,7 +420,7 @@ void cgit_print_repolist(void) sort_repolist("section"); currenturl = cgit_currenturl(); - html("
"); + html("
"); for (i = 0; i < cgit_repolist.count; i++) { char *section; diff --git a/source/ui-summary.c b/source/ui-summary.c index ada6b1b..edcbc85 100644 --- a/source/ui-summary.c +++ b/source/ui-summary.c @@ -48,7 +48,7 @@ static void print_clone_url(const char *url) htmlf("\n", columns); } - htmlf("
Clone
"); + html(""); cgit_print_branches(ctx.cfg.summary_branches); htmlf("", columns); cgit_print_tags(ctx.cfg.summary_tags); diff --git a/source/ui-tag.c b/source/ui-tag.c index d09ff2b..c384f91 100644 --- a/source/ui-tag.c +++ b/source/ui-tag.c @@ -73,7 +73,7 @@ static void print_annotated_tag(const char *revname, html("
 
\n"); html("\n", oid_to_hex(oid)); + htmlf(" (%s)\n", oid_to_hex(oid)); if (info->tagger_date > 0) { html("
tag name"); html_txt(revname); - htmlf(" (%s)
tag date"); html_txt(show_date(info->tagger_date, info->tagger_tz, -- cgit v2.8.0