From 95295aeec0ec8066c8654a58c76d4466dea20598 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Fri, 2 Oct 2026 19:24:36 +0200 Subject: [PATCH] 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 --- examples/companion_radio/ui-new/FullscreenMsgView.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/companion_radio/ui-new/FullscreenMsgView.h b/examples/companion_radio/ui-new/FullscreenMsgView.h index 9bd68656..bfe06167 100644 --- a/examples/companion_radio/ui-new/FullscreenMsgView.h +++ b/examples/companion_radio/ui-new/FullscreenMsgView.h @@ -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;