mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-15 02:08:40 -09:00
'c' to show child item counts
This commit is contained in:
parent
a90cf9c7d2
commit
cfcac262d1
2 changed files with 29 additions and 8 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
|
|
||||||
|
|
||||||
static int graph = 1, show_as = 0, info_show = 0, info_page = 0, info_start = 0;
|
static int graph = 1, show_as = 0, info_show = 0, info_page = 0, info_start = 0, show_items = 0;
|
||||||
static char *message = NULL;
|
static char *message = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -88,8 +88,8 @@ static void browse_draw_info(struct dir *dr) {
|
||||||
|
|
||||||
|
|
||||||
static void browse_draw_item(struct dir *n, int row) {
|
static void browse_draw_item(struct dir *n, int row) {
|
||||||
char ct, dt, *size, gr[11];
|
char ct, dt, *size, gr[11], *items;
|
||||||
int i, o;
|
int i, o, x;
|
||||||
float pc;
|
float pc;
|
||||||
|
|
||||||
if(n->flags & FF_BSEL)
|
if(n->flags & FF_BSEL)
|
||||||
|
|
@ -102,6 +102,9 @@ static void browse_draw_item(struct dir *n, int row) {
|
||||||
graph == 1 ? 24 :
|
graph == 1 ? 24 :
|
||||||
graph == 2 ? 20 :
|
graph == 2 ? 20 :
|
||||||
31 ;
|
31 ;
|
||||||
|
if (show_items) {
|
||||||
|
o += 7;
|
||||||
|
}
|
||||||
mvaddstr(row, o, "/..");
|
mvaddstr(row, o, "/..");
|
||||||
if(n->flags & FF_BSEL)
|
if(n->flags & FF_BSEL)
|
||||||
attroff(A_REVERSE);
|
attroff(A_REVERSE);
|
||||||
|
|
@ -137,12 +140,26 @@ static void browse_draw_item(struct dir *n, int row) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
x = 0;
|
||||||
|
|
||||||
|
mvprintw(row, x, "%c %8s ", ct, size);
|
||||||
|
x += 11;
|
||||||
|
|
||||||
|
if (show_items) {
|
||||||
|
if (n->items > 99999)
|
||||||
|
items = "> 100k";
|
||||||
|
else
|
||||||
|
items = n->items ? fullsize(n->items) : "";
|
||||||
|
mvprintw(row, x, "%6s ", items);
|
||||||
|
x += 7;
|
||||||
|
}
|
||||||
|
|
||||||
/* format and add item to the list */
|
/* format and add item to the list */
|
||||||
switch(graph) {
|
switch(graph) {
|
||||||
case 0: mvprintw(row, 0, "%c %8s %c%-*s", ct, size, dt, wincols-13, cropstr(n->name, wincols-13)); break;
|
case 0: mvprintw(row, x, " %c%-*s", dt, wincols- 2-x, cropstr(n->name, wincols- 2-x)); break;
|
||||||
case 1: mvprintw(row, 0, "%c %8s [%10s] %c%-*s", ct, size, gr, dt, wincols-25, cropstr(n->name, wincols-25)); break;
|
case 1: mvprintw(row, x, "[%10s] %c%-*s", gr, dt, wincols-14-x, cropstr(n->name, wincols-14-x)); break;
|
||||||
case 2: mvprintw(row, 0, "%c %8s [%5.1f%%] %c%-*s", ct, size, pc, dt, wincols-21, cropstr(n->name, wincols-21)); break;
|
case 2: mvprintw(row, x, "[%5.1f%%] %c%-*s", pc, dt, wincols-10-x, cropstr(n->name, wincols-10-x)); break;
|
||||||
case 3: mvprintw(row, 0, "%c %8s [%5.1f%% %10s] %c%-*s", ct, size, pc, gr, dt, wincols-32, cropstr(n->name, wincols-32));
|
case 3: mvprintw(row, x, "[%5.1f%% %10s] %c%-*s", pc, gr, dt, wincols-21-x, cropstr(n->name, wincols-21-x));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n->flags & FF_BSEL)
|
if(n->flags & FF_BSEL)
|
||||||
|
|
@ -383,6 +400,9 @@ int browse_key(int ch) {
|
||||||
graph = 0;
|
graph = 0;
|
||||||
info_show = 0;
|
info_show = 0;
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
|
show_items = !show_items;
|
||||||
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
info_show = !info_show;
|
info_show = !info_show;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
int page, start;
|
int page, start;
|
||||||
|
|
||||||
|
|
||||||
#define KEYS 14
|
#define KEYS 15
|
||||||
char *keys[KEYS*2] = {
|
char *keys[KEYS*2] = {
|
||||||
/*|----key----| |----------------description----------------|*/
|
/*|----key----| |----------------description----------------|*/
|
||||||
"up, k", "Move cursor up",
|
"up, k", "Move cursor up",
|
||||||
|
|
@ -45,6 +45,7 @@ char *keys[KEYS*2] = {
|
||||||
"t", "Toggle dirs before files when sorting",
|
"t", "Toggle dirs before files when sorting",
|
||||||
"g", "Show percentage and/or graph",
|
"g", "Show percentage and/or graph",
|
||||||
"a", "Toggle between apparent size and disk usage",
|
"a", "Toggle between apparent size and disk usage",
|
||||||
|
"c", "Toggle display of child item counts",
|
||||||
"e", "Show/hide hidden or excluded files",
|
"e", "Show/hide hidden or excluded files",
|
||||||
"i", "Show information about selected item",
|
"i", "Show information about selected item",
|
||||||
"r", "Recalculate the current directory",
|
"r", "Recalculate the current directory",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue