| Date: Wed, 5 Jul 2017 16:10:37 +0200
Fix status percentage calculation
Diffstat:
M ui_ti.c | 5 +++--
M ui_txt.c | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
--- |
| @@ -63,8 +63,9 @@ displaystatus(Item *item)
putp(tparm(cursor_address, lines-1, 0));
putp(tparm(enter_standout_mode));
- printf("%3d%%| %s:%s%s", nitems <= lines ? 100 :
- ((unsigned long long)item->printoff + lines) * 100 / nitems,
+ printf("%3lld%%| %s:%s%s",
+ (item->printoff + lines-1 >= nitems) ? 100 :
+ ((unsigned long long)item->printoff + lines-1) * 100 / nitems,
item->host, item->port, item->selector);
putp(tparm(exit_standout_mode));
|
| @@ -56,7 +56,8 @@ printstatus(Item *item)
{
size_t nitems = item->dir->nitems;
- printf("%3d%%%*c %s:%s%s (h for help): ", nitems <= lines ? 100 :
+ printf("%3lld%%%*c %s:%s%s (h for help): ",
+ (item->printoff + lines >= nitems) ? 100 :
((unsigned long long)item->printoff + lines) * 100 / nitems,
ndigits(nitems)+2, '|', item->host, item->port, item->selector);
} |