Skip to content

Commit e5fbb91

Browse files
Merge pull request #1212 from LedgerHQ/auto_update_API_LEVEL_24
[AUTO_UPDATE] Branch API_LEVEL_24
2 parents f59a8d2 + 0c559a3 commit e5fbb91

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

lib_nbgl/src/nbgl_fonts.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ bool nbgl_getTextMaxLenInNbLines(nbgl_font_id_e fontId,
602602
if (maxNbLines == 0) {
603603
text--;
604604
}
605-
width = 0;
605+
lastDelimiter = NULL;
606+
width = 0;
606607
continue;
607608
}
608609
// if \f, exit

lib_nbgl/src/nbgl_obj.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,18 +1127,23 @@ static void draw_textArea(nbgl_text_area_t *obj, nbgl_obj_t *prevObj, bool compu
11271127
}
11281128
else {
11291129
#ifdef HAVE_SE_TOUCH
1130-
uint16_t dotsWidth = nbgl_getSingleLineTextWidth(obj->fontId, "...");
11311130
// for last chunk, if nbMaxLines is used, replace the 3 last chars by "..."
1132-
// draw line except 3 last chars
1133-
if ((lineWidth + dotsWidth) >= obj->obj.area.width) {
1134-
lineLen -= 3;
1135-
}
1136-
nbgl_drawText(&rectArea, text, lineLen, obj->fontId, obj->textColor);
1137-
rectArea.x0 += nbgl_getSingleLineTextWidthInLen(obj->fontId, text, lineLen);
1131+
// only if the line doesn't end with a '\n'
1132+
if (text[lineLen] != '\n') {
1133+
uint16_t dotsWidth = nbgl_getSingleLineTextWidth(obj->fontId, "...");
1134+
if ((lineWidth + dotsWidth) >= obj->obj.area.width) {
1135+
lineLen -= 3;
1136+
}
1137+
nbgl_drawText(&rectArea, text, lineLen, obj->fontId, obj->textColor);
1138+
rectArea.x0 += nbgl_getSingleLineTextWidthInLen(obj->fontId, text, lineLen);
11381139

1139-
// draw "..." after the other chars
1140-
rectArea.width = dotsWidth;
1141-
nbgl_drawText(&rectArea, "...", 3, obj->fontId, obj->textColor);
1140+
// draw "..." after the other chars
1141+
rectArea.width = dotsWidth;
1142+
nbgl_drawText(&rectArea, "...", 3, obj->fontId, obj->textColor);
1143+
}
1144+
else {
1145+
nbgl_drawText(&rectArea, text, lineLen, obj->fontId, obj->textColor);
1146+
}
11421147
#else // HAVE_SE_TOUCH
11431148
nbgl_drawText(&rectArea, text, lineLen, fontId, obj->textColor);
11441149
#endif // HAVE_SE_TOUCH

lib_nbgl/src/nbgl_use_case.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,11 +1341,16 @@ static void displayDetailsPage(uint8_t detailsPage, bool forceFullRefresh)
13411341
NB_MAX_LINES_IN_DETAILS,
13421342
&len,
13431343
detailsContext.wrapping);
1344-
len -= 3;
1345-
// memorize next position to save processing
1346-
detailsContext.nextPageStart = currentPair.value + len;
1344+
if (currentPair.value[len] != '\n') {
1345+
len -= 3;
1346+
// memorize next position to save processing
1347+
detailsContext.nextPageStart = currentPair.value + len;
1348+
}
1349+
else {
1350+
detailsContext.nextPageStart = currentPair.value + len + 1;
1351+
}
13471352
// use special feature to keep only NB_MAX_LINES_IN_DETAILS lines and replace the last 3
1348-
// chars by "..."
1353+
// chars by "...", only if the next char to display in next page is not '\n'
13491354
content.tagValueList.nbMaxLinesForValue = NB_MAX_LINES_IN_DETAILS;
13501355
}
13511356
else {

0 commit comments

Comments
 (0)