Added progress bar constraint: cur <= total

This commit is contained in:
Bob Polis 2021-12-13 15:48:32 +01:00
parent 0539d600a0
commit 393db176f0

View File

@ -38,6 +38,7 @@ void term::progress(int prefixlen,
u8"\u258F", u8"\u258E", u8"\u258D", u8"\u258C", u8"\u258F", u8"\u258E", u8"\u258D", u8"\u258C",
u8"\u258B", u8"\u258A", u8"\u2589", u8"\u2588" u8"\u258B", u8"\u258A", u8"\u2589", u8"\u2588"
}; };
if (cur > total) cur = total;
int perclen = 5; int perclen = 5;
int barwidth = cols() - perclen - prefixlen - 1; int barwidth = cols() - perclen - prefixlen - 1;
int maxsteps = barwidth * 8; int maxsteps = barwidth * 8;