diff --git a/src/widgets/fbar.c b/src/widgets/fbar.c index 08adc35..3353d43 100644 --- a/src/widgets/fbar.c +++ b/src/widgets/fbar.c @@ -2,6 +2,7 @@ #include #include #include +#include /* Type identifier for fbar */ static int fbar_type_id = -1; @@ -128,7 +129,26 @@ static void fbar_poly_render(void *b0, int x, int y) int assertions = st.passed + st.skipped + st.failed; if(assertions == 0) assertions = 1; - guaranteeable_min = 10 * (!!st.passed + !!st.skipped + !!st.failed); + /* Try to guarantee each section the size of its text, +2 pixels */ + int min_passed=0, min_skipped=0, min_failed=0; + char str[10]; + if(st.passed) { + sprintf(str, "%d", st.passed); + dsize(str, NULL, &min_passed, NULL); + min_passed += 2; + } + if(st.skipped) { + sprintf(str, "%d", st.skipped); + dsize(str, NULL, &min_skipped, NULL); + min_skipped += 2; + } + if(st.failed) { + sprintf(str, "%d", st.failed); + dsize(str, NULL, &min_failed, NULL); + min_failed += 2; + } + + guaranteeable_min = min_passed + min_skipped + min_failed; guaranteed = (px.done > guaranteeable_min); if(guaranteed) px.done -= guaranteeable_min; @@ -136,9 +156,9 @@ static void fbar_poly_render(void *b0, int x, int y) px.skipped = (st.skipped * px.done) / assertions; px.failed = px.done - px.passed - px.skipped; if(guaranteed) { - if(st.passed) px.passed += 10; - if(st.skipped) px.skipped += 10; - if(st.failed) px.failed += 10; + px.passed += min_passed; + px.skipped += min_skipped; + px.failed += min_failed; px.done += guaranteeable_min; } diff --git a/src/widgets/flist.c b/src/widgets/flist.c index 5d6202b..1abafd3 100644 --- a/src/widgets/flist.c +++ b/src/widgets/flist.c @@ -147,7 +147,8 @@ static void flist_poly_render(void *l0, int x, int base_y) int bar_y = (l->top * area_h + l->rows/2) / l->rows; int bar_h = (l->visible * area_h + l->rows/2) / l->rows; - drect(area_x, area_y, area_x+area_w-1, area_y+area_h-1, C_RGB(24,24,24)); + drect(area_x, area_y, area_x+area_w-1, area_y+area_h-1, + C_RGB(24,24,24)); drect(area_x, area_y + bar_y, area_x + area_w - 1, area_y + bar_y + bar_h, C_BLACK); }