From ebeee7be01d9331141d5fb9bc56005d4845b8b6e Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sun, 23 May 2021 14:26:27 +0200 Subject: [PATCH] browser.c: Fix bar width floating point calculation In some cases the bar width may be 1 block short due to imprecise floating point calculations. i.e. (max_width * a) / a != max_width, whereas (max_width * (a/a)) == max_width. Or, at least, that's what I've observed so far. --- src/browser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser.c b/src/browser.c index a223b84..28d120e 100644 --- a/src/browser.c +++ b/src/browser.c @@ -160,7 +160,7 @@ static void browse_draw_graph(struct dir *n, int *x) { /* graph (10+ columns) */ if(graph == 1 || graph == 3) { uic_set(c == UIC_SEL ? UIC_GRAPH_SEL : UIC_GRAPH); - o = (int)((float)bar_size*(float)(show_as ? n->asize : n->size) / (float)(show_as ? dirlist_maxa : dirlist_maxs)); + o = (int)((float)bar_size*((float)(show_as ? n->asize : n->size) / (float)(show_as ? dirlist_maxa : dirlist_maxs))); for(i=0; i