Skip to content

Commit

Permalink
Fix missing lines in long tag/values, with no "More" button
Browse files Browse the repository at this point in the history
(cherry picked from commit 2486a54)
  • Loading branch information
nroggeman-ledger authored and cedelavergne-ledger committed Sep 6, 2024
1 parent b9fdc91 commit 8fc46ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib_nbgl/include/nbgl_use_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ extern "C" {
/**
* @brief maximum number of lines for value field in review pages
*/
#define NB_MAX_LINES_IN_REVIEW 9
#ifdef TARGET_STAX
#define NB_MAX_LINES_IN_REVIEW 11
#else // TARGET_STAX
#define NB_MAX_LINES_IN_REVIEW 10
#endif // TARGET_STAX

/**
* @brief maximum number of simultaneously displayed pairs in review pages.
Expand Down
6 changes: 5 additions & 1 deletion lib_nbgl/src/nbgl_use_case.c
Original file line number Diff line number Diff line change
Expand Up @@ -1888,6 +1888,7 @@ uint8_t nbgl_useCaseGetNbTagValuesInPage(uint8_t nbPai
while (nbPairsInPage < nbPairs) {
const nbgl_layoutTagValue_t *pair;
nbgl_font_id_e value_font;
uint16_t nbLines;

// margin between pairs
// 12 or 24 px between each tag/value pair
Expand Down Expand Up @@ -1939,7 +1940,10 @@ uint8_t nbgl_useCaseGetNbTagValuesInPage(uint8_t nbPai
// value height
currentHeight += nbgl_getTextHeightInWidth(
value_font, pair->value, AVAILABLE_WIDTH, tagValueList->wrapping);
if (currentHeight >= TAG_VALUE_AREA_HEIGHT) {
// nb lines for value
nbLines = nbgl_getTextNbLinesInWidth(
value_font, pair->value, AVAILABLE_WIDTH, tagValueList->wrapping);
if ((currentHeight >= TAG_VALUE_AREA_HEIGHT) || (nbLines > NB_MAX_LINES_IN_REVIEW)) {
if (nbPairsInPage == 0) {
// Pair too long to fit in a single screen
// It will be the only one of the page and has a specific display behavior
Expand Down

0 comments on commit 8fc46ea

Please sign in to comment.