sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit 72f22a1a005e90143cff6749fc8022164c2e357a
parent 3062310dc626a5604333d6c28945964fa25fff68
Author: Quentin Rameau <quinq@fifth.space>
Date:   Wed,  5 Jul 2017 16:10:37 +0200

Fix status percentage calculation

Diffstat:
ui_ti.c | 5+++--
ui_txt.c | 3++-
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ui_ti.c b/ui_ti.c @@ -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)); diff --git a/ui_txt.c b/ui_txt.c @@ -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); }