diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-07-04 18:06:00 +0200 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2020-07-12 18:30:02 +0200 |
commit | a216bc2d35b6edf4dadf55350f09d7cbf229fbf7 (patch) | |
tree | 83322421a44f3da0de706e28d616cd65437efe25 | |
parent | 1035aed81a6b919033921ead583a88db5e2d80a2 (diff) |
Scale size bar with max column size
Use 'max(10, column_size / 7)' instead of a fixed size of 10
-rw-r--r-- | src/browser.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/browser.c b/src/browser.c index 4306cbd..a223b84 100644 --- a/src/browser.c +++ b/src/browser.c @@ -132,13 +132,13 @@ static void browse_draw_flag(struct dir *n, int *x) { static void browse_draw_graph(struct dir *n, int *x) { float pc = 0.0f; - int o, i; + int o, i, bar_size = wincols/7 > 10 ? wincols/7 : 10; enum ui_coltype c = n->flags & FF_BSEL ? UIC_SEL : UIC_DEFAULT; if(!graph) return; - *x += graph == 1 ? 13 : graph == 2 ? 9 : 20; + *x += graph == 1 ? (bar_size + 3) : graph == 2 ? 9 : (bar_size + 10); if(n == dirlist_parent) return; @@ -157,11 +157,11 @@ static void browse_draw_graph(struct dir *n, int *x) { if(graph == 3) addch(' '); - /* graph (10 columns) */ + /* graph (10+ columns) */ if(graph == 1 || graph == 3) { uic_set(c == UIC_SEL ? UIC_GRAPH_SEL : UIC_GRAPH); - o = (int)(10.0f*(float)(show_as ? n->asize : n->size) / (float)(show_as ? dirlist_maxa : dirlist_maxs)); - for(i=0; i<10; i++) + 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 ? '#' : ' '); } |