From 781d4c24c15334680ae2fadbb244fa98cd9f6025 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 23 Oct 2018 17:48:45 +0200 Subject: [PATCH] layout: don't split short addresses in layoutAddress --- firmware/layout2.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/firmware/layout2.c b/firmware/layout2.c index d50ef78c84..ef78519a51 100644 --- a/firmware/layout2.c +++ b/firmware/layout2.c @@ -546,13 +546,17 @@ void layoutAddress(const char *address, const char *desc, bool qrcode, bool igno } } } else { - uint32_t rowlen = (addrlen - 1) / (addrlen <= 42 ? 2 : addrlen <= 63 ? 3 : 4) + 1; - const char **str = split_message((const uint8_t *)address, addrlen, rowlen); if (desc) { oledDrawString(0, 0 * 9, desc, FONT_STANDARD); } - for (int i = 0; i < 4; i++) { - oledDrawString(0, (i + 1) * 9 + 4, str[i], FONT_FIXED); + if (addrlen > 10) { // don't split short addresses + uint32_t rowlen = (addrlen - 1) / (addrlen <= 42 ? 2 : addrlen <= 63 ? 3 : 4) + 1; + const char **str = split_message((const uint8_t *)address, addrlen, rowlen); + for (int i = 0; i < 4; i++) { + oledDrawString(0, (i + 1) * 9 + 4, str[i], FONT_FIXED); + } + } else { + oledDrawString(0, (0 + 1) * 9 + 4, address, FONT_FIXED); } oledDrawString(0, 42, address_n_str(address_n, address_n_count, address_is_account), FONT_STANDARD); }