Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix display last symbol in multiline text #2967

Merged
merged 6 commits into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions applications/services/gui/elements.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down