git clone https://garage44.eu/jeroen/midas.gitcartopolis-agent · 2026-11-28T19:58:42Z
fix(codeview): the clone command wraps on a phone, and is said once on the front page The front page's "Get it" line kept its code unbroken (code is nowrap), so on a phone it ran past the screen and the browser zoomed the whole page out: the file list sat in two thirds of the width. It now wraps like the header's clone line, and the front page leaves that header line out, since its body already says how to get the project.
src/codeview.rs | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/codeview.rs b/src/codeview.rs
index 8cb5dc0..c6d1298 100644
--- a/src/codeview.rs
+++ b/src/codeview.rs
@@ -150,7 +150,7 @@ const STYLE: &str = "body{font-size:16px;line-height:1.55}\
.pub-card:hover{border-color:var(--m-accent);text-decoration:none}\
.pub-card strong{color:var(--m-accent-text);font-size:1.05rem}.pub-card time{margin-top:auto;color:var(--m-text-faint);font-size:13px}\
pre{background:var(--m-surface-sunken);border:1px solid var(--m-border);border-radius:var(--m-radius);padding:12px;overflow:auto;font-size:13px}\
- code{background:var(--m-surface-sunken);border-radius:var(--m-radius-sm);padding:0 .3rem;white-space:nowrap}.clone code{white-space:normal;overflow-wrap:anywhere}\
+ code{background:var(--m-surface-sunken);border-radius:var(--m-radius-sm);padding:0 .3rem;white-space:nowrap}.clone code,.get code{white-space:normal;overflow-wrap:anywhere}\
table{border-collapse:separate;border-spacing:0;width:100%;background:var(--m-surface);border:1px solid var(--m-border);border-radius:var(--m-radius-lg);overflow:hidden}\
td{padding:8px 12px;border-bottom:1px solid var(--m-border);vertical-align:top}tr:last-child td{border-bottom:0}\
.muted{color:var(--m-text-dim)}td.muted{white-space:nowrap}h2{font-size:1.1rem;margin:24px 0 8px}\
@@ -192,13 +192,16 @@ fn page_html(title: &str, host: &str, crumbs: &str, rest: &str, body: &str) -> S
)
}
-fn frame(repo: &str, host: &str, title: &str, body: &str) -> String {
+/// `front` is the project's front page, whose body says how to get it
+/// already: the header leaves its clone line out rather than say it twice.
+fn frame(repo: &str, host: &str, title: &str, body: &str, front: bool) -> String {
let key = repo.trim_end_matches(".git");
let (k, h) = (esc(key), esc(host));
+ let clone = if front { String::new() } else { format!("<span class=\"clone muted\">clone: <code>git clone https://{h}/{k}.git</code></span>") };
page_html(
&format!("{} · {k}", esc(title)), host,
&format!("<span>/</span><a href=\"/{k}\">{k}</a>"),
- &format!("<a class=\"end\" href=\"/{k}/log\">log</a><span class=\"clone muted\">clone: <code>git clone https://{h}/{k}.git</code></span>"),
+ &format!("<a class=\"end\" href=\"/{k}/log\">log</a>{clone}"),
body,
)
}
@@ -351,7 +354,7 @@ pub fn page(repo: &str, host: &str, tail: &str, q: &str) -> Result<Option<Page>>
v["size"], esc(key), link(&path), revq);
}
let title = if path.is_empty() { key.to_string() } else { path.clone() };
- return Ok(Some(Page::Html(frame(repo, host, &title, &body))));
+ return Ok(Some(Page::Html(frame(repo, host, &title, &body, path.is_empty() && rev.is_none()))));
}
if tail == "log" {
let mut body = "<table class=\"log\">".to_string();
@@ -362,7 +365,7 @@ pub fn page(repo: &str, host: &str, tail: &str, q: &str) -> Result<Option<Page>>
esc(c["at"].as_str().unwrap_or("").get(..10).unwrap_or("")));
}
body += "</table>";
- return Ok(Some(Page::Html(frame(repo, host, "log", &body))));
+ return Ok(Some(Page::Html(frame(repo, host, "log", &body, false))));
}
if let Some(sha) = tail.strip_prefix("commit/") {
if !sha.chars().all(|c| c.is_ascii_hexdigit()) {
@@ -372,7 +375,7 @@ pub fn page(repo: &str, host: &str, tail: &str, q: &str) -> Result<Option<Page>>
let body = format!("<p class=\"muted\">{} · {}</p><pre>{}</pre><pre>{}</pre>",
esc(c["author"].as_str().unwrap_or("")), esc(c["at"].as_str().unwrap_or("")),
esc(c["message"].as_str().unwrap_or("")), esc(c["diff"].as_str().unwrap_or("")));
- return Ok(Some(Page::Html(frame(repo, host, sha, &body))));
+ return Ok(Some(Page::Html(frame(repo, host, sha, &body, false))));
}
Ok(None)
}