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
This commit is contained in:
Alexander Larsson
2018-12-20 11:22:30 +01:00
committed by Atomic Bot
parent 4514286596
commit 830a750d20

View File

@@ -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;