2 files changed, +33, -16
d816177Wrap commit messages around the file count
src/html.rs
+23, -7
style.css
+10, -9
+23, -7
@@ -53,6 +53,8 @@ const REF_CHIPS: usize = 2;
53 53
54 54 const MAX_LINKS: usize = 40;
55 55
56+const LONG_WORD: usize = 50;
57+
56 58 const BASE64_CHARS: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
57 59
58 60 const ICONS: [(&str, &str); 25] = [
@@ -1069,6 +1071,22 @@ pub fn diff_stat(diff: &CommitDiff) -> String {
10691071 )
10701072 }
10711073
1074+fn break_long_words(text: &str) -> String {
1075+ text.split_inclusive(char::is_whitespace)
1076+ .map(|piece| {
1077+ let word = piece.trim_end();
1078+ if word.chars().count() <= LONG_WORD {
1079+ return escape_str(piece);
1080+ }
1081+ format!(
1082+ "<span class=\"long-word\">{}</span>{}",
1083+ escape_str(word),
1084+ &piece[word.len()..]
1085+ )
1086+ })
1087+ .collect()
1088+}
1089+
10721090 pub fn gen_commit(
10731091 repo: &RepoInfo,
10741092 git_ref: &RefInfo,
@@ -1112,20 +1130,18 @@ pub fn gen_commit(
11121130 } else {
11131131 format!(
11141132 "<div class=\"white-space-bs commit-body\">{}</div>\n",
1115 - escape_str(rest)
1133+ break_long_words(rest)
11161134 )
11171135 };
11181136
11191137 let mut body = format!(
11201138 "\
11211139 <div class=\"box commit-head\">\n\
1122 -<div class=\"flex gap commit-msg\">\n\
1123 -<div class=\"flex-1\">\n\
1140+<div class=\"commit-msg\">\n\
1141+<div class=\"commit-changes\">{}</div>\n\
11241142 <div class=\"commit-title\"><span class=\"commit-id\">{}{short}</span>{}</div>\n\
11251143 {message_body}\
11261144 </div>\n\
1127 -<div>{}</div>\n\
1128 -</div>\n\
11291145 <div class=\"commit-meta\">\n\
11301146 <div>author</div>\n\
11311147 <div>{} <{}> on {}</div>\n\
@@ -1135,9 +1151,9 @@ pub fn gen_commit(
11351151 </div>\n\
11361152 </div>\n\
11371153 ",
1138 - icon("git-commit"),
1139 - escape_str(&commit.summary),
11401154 diff_stat(diff),
1155+ icon("git-commit"),
1156+ break_long_words(&commit.summary),
11411157 escape_str(&commit.author_name),
11421158 escape_str(&commit.author_email),
11431159 format_zoned(&commit.author_date, format),
+10, -9
@@ -1318,6 +1318,7 @@ pre.chroma[style] {
13181318
13191319 .commit-parent {
13201320 display: grid;
1321+ align-self: end;
13211322 grid-column: span 2;
13221323 grid-template-columns: subgrid;
13231324 column-gap: 0.3em;
@@ -1328,12 +1329,16 @@ pre.chroma[style] {
13281329 }
13291330
13301331 .commit-msg {
1331 - align-items: baseline;
13321332 padding: 0.45rem 0.75rem 0.7rem;
13331333 font-size: var(--text-sm);
13341334 line-height: 1.45;
13351335 }
13361336
1337+.commit-changes {
1338+ float: right;
1339+ margin: 0.33rem 0 0 0.65rem;
1340+}
1341+
13371342 .commit-title {
13381343 font-size: var(--text-lg);
13391344 font-weight: 600;
@@ -1350,6 +1355,10 @@ pre.chroma[style] {
13501355 margin-top: 0.35rem;
13511356 }
13521357
1358+.long-word {
1359+ word-break: break-all;
1360+}
1361+
13531362 .summary-meta-box {
13541363 padding: 0;
13551364 }
@@ -1567,14 +1576,6 @@ pre.chroma[style] {
15671576 .branch-row .branch-sha::after {
15681577 content: none;
15691578 }
1570 -
1571 - .commit-meta {
1572 - grid-template-columns: max-content 1fr;
1573 - }
1574 -
1575 - .commit-parent {
1576 - display: contents;
1577 - }
15781579 }
15791580
15801581 @media (prefers-reduced-motion: reduce) {