mail client (IMAP/SMTP)
git clone https://git.lucas.co/cce-mail.git
fix: list rows survive real Gmail data — CRLF snippets + wide dates
First live IMAP sync (app-password auth) surfaced two row bugs: bodies
with CRLF line endings left bare '\r' after the '\n' replace and the
renderer treats it as a line break, bleeding preview text into the rows
below — snippets now collapse all whitespace; and 'Jul 27 13:36'-style
server dates overflowed under the scrollbar — the date is right-aligned
inside the row via estimate_width.
Co-Authored-By: Claude Fable 5 <[email protected]>
src/main.rs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index 31fc469..372a50d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1114,10 +1114,11 @@ impl ClearEmailApp {
color: if !email.read { [0xff, 0xff, 0xff] } else { [0xb0, 0xb0, 0xb8] },
});
- // Date
+ // Date — right-aligned inside the row, clear of the scrollbar strip
+ let date_w = TextLabel::estimate_width(&email.date, 9.0);
labels.push(TextLabel {
text: email.date.clone(),
- x: list_x + 250.0,
+ x: list_x + 300.0 - 14.0 - date_w,
y: draw_y + 7.0,
font_size: 9.0,
color: [0x70, 0x70, 0x75],
@@ -1132,8 +1133,10 @@ impl ClearEmailApp {
color: if !email.read { [0x3a, 0x9a, 0xff] } else { [0x83, 0x83, 0x8a] },
});
- // Snippet
- let snippet_raw = email.body.replace('\n', " ");
+ // Snippet — collapse ALL whitespace: CRLF bodies leave bare '\r'
+ // after a plain '\n' replace, and the renderer treats it as a
+ // line break, bleeding preview lines into the next row.
+ let snippet_raw = email.body.split_whitespace().collect::<Vec<_>>().join(" ");
let snippet = ellipsize(&snippet_raw, 37);
labels.push(TextLabel {
text: snippet,