mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-14 09:48:40 -09:00
Scale size bar with max column size
Use 'max(10, column_size / 7)' instead of a fixed size of 10
This commit is contained in:
parent
1035aed81a
commit
a216bc2d35
1 changed files with 5 additions and 5 deletions
|
|
@ -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) {
|
||||||
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 ? '#' : ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue