From 8262712af8cac7c33f3b9ea91a99f25052c4a165 Mon Sep 17 00:00:00 2001 From: Nicolas Roggeman Date: Mon, 9 Sep 2024 16:31:10 +0200 Subject: [PATCH] Fix wrong word cutting at the end of some too long text in details (cherry picked from commit 5544a0057e34fd10bdc8211d1d588d39aaa1bc90) --- lib_nbgl/src/nbgl_fonts.c | 4 ++++ lib_nbgl/src/nbgl_use_case.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_nbgl/src/nbgl_fonts.c b/lib_nbgl/src/nbgl_fonts.c index 06eb80d16..006b0ef8b 100644 --- a/lib_nbgl/src/nbgl_fonts.c +++ b/lib_nbgl/src/nbgl_fonts.c @@ -608,6 +608,10 @@ bool nbgl_getTextMaxLenInNbLines(nbgl_font_id_e fontId, // if \n, reset width if (unicode == '\n') { maxNbLines--; + // if last line is reached, let's rewind before carriage return + if (maxNbLines == 0) { + text--; + } width = 0; continue; } diff --git a/lib_nbgl/src/nbgl_use_case.c b/lib_nbgl/src/nbgl_use_case.c index 9859b30d1..a0b908b2e 100644 --- a/lib_nbgl/src/nbgl_use_case.c +++ b/lib_nbgl/src/nbgl_use_case.c @@ -1051,7 +1051,7 @@ static const char *getDetailsPageAt(uint8_t detailsPage) AVAILABLE_WIDTH, NB_MAX_LINES_IN_DETAILS, &len, - false); + detailsContext.wrapping); len -= 3; currentChar = currentChar + len; }