fix(ui): a space that overflows ends the wrapped line there

wrapLines carried the overflowing space's word to the next line too
early, so bubbles wrapped short of their width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-02 19:24:36 +02:00
co-authored by Claude Opus 5.5
parent 0bbf2fa2b3
commit 95295aeec0
@@ -79,7 +79,13 @@ struct FullscreenMsgView {
// for it (it's below the font's first codepoint), so it also ate width.
if (cp == '\n' || cp == '\r') { brk = cp_start; break; }
uint16_t cw = display.getCodepointWidth(cp);
if (width + cw > max_px && cp_start > seg) { p = cp_start; break; }
if (width + cw > max_px && cp_start > seg) {
// A space that doesn't fit is where this line ends: the word before
// it fits whole, so it stays here instead of moving down.
if (cp == ' ') last_sp = cp_start;
p = cp_start;
break;
}
if (cp == ' ') last_sp = cp_start;
width += cw;
last_fit = p;