From 70c5d6239e8a42fef1d06571044ee5df3e2dac59 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Tue, 18 Jun 2024 09:36:48 -0400 Subject: [Feature] splash.h split too long strings to multiple lines If no split tokens are found the string just goes off into space instead shoten the string till it fits and continue on with the remaining string Change-Id: I7fa3619fe8c75ec6c849996d4c3518409938152b --- apps/gui/splash.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/gui/splash.c b/apps/gui/splash.c index d0f1fbb67c..e8ad591264 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -90,6 +90,18 @@ static bool splash_internal(struct screen * screen, const char *fmt, va_list ap, break; /* screen full or out of lines */ x = 0; y += chr_h; + + /* split when it fits since we didn't find a valid token to break on */ + size_t nl = next_len; + while (w > vp->width && --nl > 0) + w = font_getstringnsize(next, nl, NULL, NULL, fontnum); + + if (nl > 1 && nl != next_len) + { + next_len = nl; + store = next + nl; /* move the start pos for the next token read */ + } + lines[++line].len = next_len; lines[line].str = next; } -- cgit v1.2.3