Skip to content
Snippets Groups Projects
Commit a216bc2d authored by Christian Göttsche's avatar Christian Göttsche
Browse files

Scale size bar with max column size

Use 'max(10, column_size / 7)' instead of a fixed size of 10
parent 1035aed8
No related branches found
No related tags found
No related merge requests found
...@@ -132,13 +132,13 @@ static void browse_draw_flag(struct dir *n, int *x) { ...@@ -132,13 +132,13 @@ static void browse_draw_flag(struct dir *n, int *x) {
static void browse_draw_graph(struct dir *n, int *x) { static void browse_draw_graph(struct dir *n, int *x) {
float pc = 0.0f; 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; enum ui_coltype c = n->flags & FF_BSEL ? UIC_SEL : UIC_DEFAULT;
if(!graph) if(!graph)
return; 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) if(n == dirlist_parent)
return; return;
...@@ -157,11 +157,11 @@ static void browse_draw_graph(struct dir *n, int *x) { ...@@ -157,11 +157,11 @@ static void browse_draw_graph(struct dir *n, int *x) {
if(graph == 3) if(graph == 3)
addch(' '); addch(' ');
/* graph (10 columns) */ /* graph (10+ columns) */
if(graph == 1 || graph == 3) { if(graph == 1 || graph == 3) {
uic_set(c == UIC_SEL ? UIC_GRAPH_SEL : UIC_GRAPH); 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)); o = (int)((float)bar_size*(float)(show_as ? n->asize : n->size) / (float)(show_as ? dirlist_maxa : dirlist_maxs));
for(i=0; i<10; i++) for(i=0; i<bar_size; i++)
addch(i < o ? '#' : ' '); addch(i < o ? '#' : ' ');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment