From 94aa0aaa762ad818bb00e5d37dd7abbb7a2b80f7 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 16 Sep 2020 14:13:44 -0400 Subject: [PATCH] yield: don't print overyield --- src/demo/yield.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/demo/yield.c b/src/demo/yield.c index 828e47c30..aa74cf4b1 100644 --- a/src/demo/yield.c +++ b/src/demo/yield.c @@ -74,6 +74,9 @@ int yield_demo(struct notcurses* nc){ ncplane_set_bg_rgb(std, 0x10, 0x10, 0x10); ncplane_set_fg_rgb(std, 0xf0, 0x20, 0x20); ncplane_set_attr(std, NCSTYLE_BOLD); + if(tfilled > threshold_painted){ + tfilled = threshold_painted; // don't allow printing of 100.1% etc + } ncplane_printf_aligned(std, 3, NCALIGN_CENTER, "Yield: %3.1f%%", ((double)tfilled * 100) / threshold_painted); ncplane_set_attr(std, NCSTYLE_NONE); DEMO_RENDER(nc);