From 74563e16afd63e44f1f0f936e5dc50c7d8a51af9 Mon Sep 17 00:00:00 2001 From: Nicolas Roggeman Date: Fri, 24 Jan 2025 14:47:58 +0100 Subject: [PATCH] Fix case when multi-pages text contains '\n' at page break --- lib_nbgl/src/nbgl_step.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_nbgl/src/nbgl_step.c b/lib_nbgl/src/nbgl_step.c index 69bb1328f..95e4f9118 100644 --- a/lib_nbgl/src/nbgl_step.c +++ b/lib_nbgl/src/nbgl_step.c @@ -251,6 +251,10 @@ static void displayTextPage(StepContext_t *ctx, uint8_t textPage) BAGL_FONT_OPEN_SANS_REGULAR_11px_1bpp, txt, AVAILABLE_WIDTH, nbLines, &len, true); // memorize next position to save processing ctx->textContext.nextPageStart = txt + len; + // if the next char is '\n', skip it to avoid starting with an empty line + if (*ctx->textContext.nextPageStart == '\n') { + ctx->textContext.nextPageStart++; + } } else { ctx->textContext.nextPageStart = NULL;