From b51af7ceb43fc00e862637682249c4ee43ca6898 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Wed, 20 Jul 2016 15:18:04 +0200 Subject: [PATCH] Use the whole length of the progress bar for text --- source/ui.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/ui.c b/source/ui.c index 057bf5c..8a573fc 100644 --- a/source/ui.c +++ b/source/ui.c @@ -523,8 +523,8 @@ bool ShowProgress(u64 current, u64 total, const char* opstr) const u32 text_pos_y = bar_pos_y + bar_height + 2; u32 prog_width = ((total > 0) && (current <= total)) ? (current * (bar_width-4)) / total : 0; u32 prog_percent = ((total > 0) && (current <= total)) ? (current * 100) / total : 0; - char tempstr[32]; - char progstr[32]; + char tempstr[64]; + char progstr[64]; if (!current || last_prog_width > prog_width) { ClearScreenF(true, false, COLOR_STD_BG); @@ -533,8 +533,8 @@ bool ShowProgress(u64 current, u64 total, const char* opstr) } DrawRectangle(TOP_SCREEN, bar_pos_x + 2, bar_pos_y + 2, prog_width, bar_height - 4, COLOR_STD_FONT); - TruncateString(tempstr, opstr, 24, 8); - snprintf(progstr, 32, "%s (%lu%%)", tempstr, prog_percent); + TruncateString(tempstr, opstr, (bar_width / FONT_WIDTH_EXT) - 7, 8); + snprintf(progstr, 64, "%s (%lu%%)", tempstr, prog_percent); DrawString(TOP_SCREEN, progstr, bar_pos_x, text_pos_y, COLOR_STD_FONT, COLOR_STD_BG); DrawString(TOP_SCREEN, "(hold B to cancel)", bar_pos_x + 2, text_pos_y + 14, COLOR_STD_FONT, COLOR_STD_BG);