From dc7517e5fdfa409eab53e4b2638a333ce82ed83e Mon Sep 17 00:00:00 2001 From: Dzhos Oleksii <35292229+Programistich@users.noreply.github.com> Date: Tue, 22 Aug 2023 22:15:38 +0300 Subject: [PATCH] Fix display last symbol in multiline text (#2967) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert submodules * Compare without round * Gui: slightly more integer logic in elements_get_max_chars_to_fit Co-authored-by: hedger Co-authored-by: あく --- applications/services/gui/elements.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/services/gui/elements.c b/applications/services/gui/elements.c index 9b7c84ec..37ecfde4 100644 --- a/applications/services/gui/elements.c +++ b/applications/services/gui/elements.c @@ -236,11 +236,11 @@ static size_t } if(len_px > px_left) { - uint8_t excess_symbols_approximately = - roundf((float)(len_px - px_left) / ((float)len_px / (float)text_size)); + size_t excess_symbols_approximately = + ceilf((float)(len_px - px_left) / ((float)len_px / (float)text_size)); // reduce to 5 to be sure dash fit, and next line will be at least 5 symbols long if(excess_symbols_approximately > 0) { - excess_symbols_approximately = MAX(excess_symbols_approximately, 5); + excess_symbols_approximately = MAX(excess_symbols_approximately, 5u); result = text_size - excess_symbols_approximately - 1; } else { result = text_size;