From c3a7c62214d2937c32205236a0dea993b1377720 Mon Sep 17 00:00:00 2001 From: Shautvast Date: Wed, 18 Feb 2026 16:35:49 +0100 Subject: [PATCH] Align sender and subject columns in inbox list Compute the max sender width across the loaded emails (capped at 40 chars) and pad each sender field to that width. Long senders are truncated with an ellipsis. Subject column now starts at a consistent position regardless of sender name length. Co-Authored-By: Claude Sonnet 4.6 --- src/lib.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 0c2509e..cd2dcb3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -266,10 +266,21 @@ pub fn main(config: &Config, terminal: &mut Terminal>) .style(Style::default().fg(Color::Yellow)); frame.render_widget(p, layout[0]); } else { + let max_from = emails.iter() + .map(|e| e.from.chars().count()) + .max() + .unwrap_or(20) + .min(40); let items: Vec = emails .iter() .map(|e| { - ListItem::new(format!("{} | {} | {}", e.date, e.from, e.subject)) + let from_len = e.from.chars().count(); + let from = if from_len > max_from { + format!("{}…", e.from.chars().take(max_from.saturating_sub(1)).collect::()) + } else { + format!("{: