From 830a750d207df6d91c9fbcc7b54ab8c197ff8b50 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 20 Dec 2018 11:22:30 +0100 Subject: [PATCH] cli: Limit length of progress bar This limits the witdh of the progress bar, because it looked really weird on a wide terminal and kept changing width as the text at the end (speed, time left, etc) changed. It is now never more than 20 chars wide, which is fine with the new increase in fidelity using unicode blocks. Closes: #2449 Approved by: alexlarsson --- app/flatpak-cli-transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/flatpak-cli-transaction.c b/app/flatpak-cli-transaction.c index d2161f43..50d9f3fc 100644 --- a/app/flatpak-cli-transaction.c +++ b/app/flatpak-cli-transaction.c @@ -288,7 +288,7 @@ progress_changed_cb (FlatpakTransactionProgress *progress, spin_op_progress (cli, op); - bar_length = cli->table_width - (strlen (cli->progress_msg) + 4 + 4 + cli->speed_len); + bar_length = MIN (20, cli->table_width - (strlen (cli->progress_msg) + 4 + 4 + cli->speed_len)); n_full = (bar_length * percent) / 100; partial = (((bar_length * percent) % 100) * G_N_ELEMENTS(partial_blocks) ) / 100;