mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
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.
This commit is contained in:
parent
a6b4aead43
commit
ebeee7be01
1 changed files with 1 additions and 1 deletions
|
|
@ -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<bar_size; i++)
|
||||
addch(i < o ? '#' : ' ');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue