Skip to content
Snippets Groups Projects
Commit cfcac262 authored by Chris West (Faux)'s avatar Chris West (Faux)
Browse files

'c' to show child item counts

parent a90cf9c7
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@
#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;
......@@ -88,8 +88,8 @@ static void browse_draw_info(struct dir *dr) {
static void browse_draw_item(struct dir *n, int row) {
char ct, dt, *size, gr[11];
int i, o;
char ct, dt, *size, gr[11], *items;
int i, o, x;
float pc;
if(n->flags & FF_BSEL)
......@@ -102,6 +102,9 @@ static void browse_draw_item(struct dir *n, int row) {
graph == 1 ? 24 :
graph == 2 ? 20 :
31 ;
if (show_items) {
o += 7;
}
mvaddstr(row, o, "/..");
if(n->flags & FF_BSEL)
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 */
switch(graph) {
case 0: mvprintw(row, 0, "%c %8s %c%-*s", ct, size, dt, wincols-13, cropstr(n->name, wincols-13)); break;
case 1: mvprintw(row, 0, "%c %8s [%10s] %c%-*s", ct, size, gr, dt, wincols-25, cropstr(n->name, wincols-25)); 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 3: mvprintw(row, 0, "%c %8s [%5.1f%% %10s] %c%-*s", ct, size, pc, gr, dt, wincols-32, cropstr(n->name, wincols-32));
case 0: mvprintw(row, x, " %c%-*s", dt, wincols- 2-x, cropstr(n->name, wincols- 2-x)); 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, x, "[%5.1f%%] %c%-*s", pc, dt, wincols-10-x, cropstr(n->name, wincols-10-x)); break;
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)
......@@ -383,6 +400,9 @@ int browse_key(int ch) {
graph = 0;
info_show = 0;
break;
case 'c':
show_items = !show_items;
break;
case 'i':
info_show = !info_show;
break;
......
......@@ -32,7 +32,7 @@
int page, start;
#define KEYS 14
#define KEYS 15
char *keys[KEYS*2] = {
/*|----key----| |----------------description----------------|*/
"up, k", "Move cursor up",
......@@ -45,6 +45,7 @@ char *keys[KEYS*2] = {
"t", "Toggle dirs before files when sorting",
"g", "Show percentage and/or graph",
"a", "Toggle between apparent size and disk usage",
"c", "Toggle display of child item counts",
"e", "Show/hide hidden or excluded files",
"i", "Show information about selected item",
"r", "Recalculate the current directory",
......
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