2939cc96
Truncate TUI linked-commit subject to 60 chars for CLI parity
alex emery 2026-04-12 08:43
TUI was rendering the full commit summary while the CLI truncated to 60 chars. On narrow terminals the untruncated line wrapped or clipped. Reuse the existing truncate_summary helper by exposing it as pub(crate).
diff --git a/src/lib.rs b/src/lib.rs index b6be19b..50a2fe7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -709,7 +709,7 @@ fn search(repo: &Repository, query: &str) -> Result<(), error::Error> { Ok(()) } fn truncate_summary(s: &str, max_chars: usize) -> String { pub(crate) fn truncate_summary(s: &str, max_chars: usize) -> String { let mut out = String::new(); for (count, c) in s.chars().enumerate() { if count + 1 > max_chars { diff --git a/src/tui/widgets.rs b/src/tui/widgets.rs index e1f2d0a..a7a883e 100644 --- a/src/tui/widgets.rs +++ b/src/tui/widgets.rs @@ -485,7 +485,10 @@ fn build_issue_detail( .ok() .and_then(|oid| r.find_commit(oid).ok()) .map(|commit| { let subject = commit.summary().unwrap_or("").to_string(); let subject = commit .summary() .map(|s| crate::truncate_summary(s, 60)) .unwrap_or_default(); let author = commit.author().name().unwrap_or("unknown").to_string(); (subject, author) })