mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
split the browse-draw mode to -3 option
This commit is contained in:
parent
9682a488ef
commit
c98ae6bcb9
3 changed files with 29 additions and 18 deletions
|
|
@ -260,7 +260,7 @@ void browse_draw() {
|
||||||
int selected = 0, i;
|
int selected = 0, i;
|
||||||
|
|
||||||
extern struct dir *root; /* root directory struct we're scanning */
|
extern struct dir *root; /* root directory struct we're scanning */
|
||||||
if (pstate == ST_CALC) {
|
if (dir_ui == 3 && pstate == ST_CALC) {
|
||||||
static bool open = false;
|
static bool open = false;
|
||||||
if (!open) {
|
if (!open) {
|
||||||
dirlist_open(root);
|
dirlist_open(root);
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,9 @@ void dir_draw() {
|
||||||
else
|
else
|
||||||
draw_progress();
|
draw_progress();
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
browse_draw();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,21 +215,27 @@ void dir_draw() {
|
||||||
/* This function can't be called unless dir_ui == 2
|
/* This function can't be called unless dir_ui == 2
|
||||||
* (Doesn't really matter either way). */
|
* (Doesn't really matter either way). */
|
||||||
int dir_key(int ch) {
|
int dir_key(int ch) {
|
||||||
if(dir_fatalerr)
|
switch (dir_ui) {
|
||||||
return 1;
|
case 3:
|
||||||
if(confirm_quit && confirm_quit_while_scanning_stage_1_passed) {
|
browse_key(ch);
|
||||||
if (ch == 'y'|| ch == 'Y') {
|
break;
|
||||||
|
default:
|
||||||
|
if(dir_fatalerr)
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
if(confirm_quit && confirm_quit_while_scanning_stage_1_passed) {
|
||||||
confirm_quit_while_scanning_stage_1_passed = 0;
|
if (ch == 'y'|| ch == 'Y') {
|
||||||
return 0;
|
return 1;
|
||||||
|
} else {
|
||||||
|
confirm_quit_while_scanning_stage_1_passed = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else if(ch == 'q') {
|
||||||
|
if(confirm_quit) {
|
||||||
|
confirm_quit_while_scanning_stage_1_passed = 1;
|
||||||
|
return 0;
|
||||||
|
} else
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
} else if(ch == 'q') {
|
|
||||||
if(confirm_quit) {
|
|
||||||
confirm_quit_while_scanning_stage_1_passed = 1;
|
|
||||||
return 0;
|
|
||||||
} else
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
src/main.c
10
src/main.c
|
|
@ -52,7 +52,7 @@ static long lastupdate = 999;
|
||||||
|
|
||||||
static void screen_draw() {
|
static void screen_draw() {
|
||||||
switch(pstate) {
|
switch(pstate) {
|
||||||
case ST_CALC: browse_draw(); break;
|
case ST_CALC: dir_draw(); break;
|
||||||
case ST_BROWSE: browse_draw(); break;
|
case ST_BROWSE: browse_draw(); break;
|
||||||
case ST_HELP: help_draw(); break;
|
case ST_HELP: help_draw(); break;
|
||||||
case ST_SHELL: shell_draw(); break;
|
case ST_SHELL: shell_draw(); break;
|
||||||
|
|
@ -98,7 +98,7 @@ int input_handle(int wait) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch(pstate) {
|
switch(pstate) {
|
||||||
case ST_CALC: return browse_key(ch);
|
case ST_CALC: return dir_key(ch);
|
||||||
case ST_BROWSE: return browse_key(ch);
|
case ST_BROWSE: return browse_key(ch);
|
||||||
case ST_HELP: return help_key(ch);
|
case ST_HELP: return help_key(ch);
|
||||||
case ST_DEL: return delete_key(ch);
|
case ST_DEL: return delete_key(ch);
|
||||||
|
|
@ -133,6 +133,7 @@ static void argv_parse(int argc, char **argv) {
|
||||||
{ '0', 0, "-0" },
|
{ '0', 0, "-0" },
|
||||||
{ '1', 0, "-1" },
|
{ '1', 0, "-1" },
|
||||||
{ '2', 0, "-2" },
|
{ '2', 0, "-2" },
|
||||||
|
{ '3', 0, "-3" },
|
||||||
{ 1, 1, "--exclude" },
|
{ 1, 1, "--exclude" },
|
||||||
{ 'X', 1, "-X,--exclude-from" },
|
{ 'X', 1, "-X,--exclude-from" },
|
||||||
{ 'L', 0, "-L,--follow-symlinks" },
|
{ 'L', 0, "-L,--follow-symlinks" },
|
||||||
|
|
@ -160,7 +161,7 @@ static void argv_parse(int argc, char **argv) {
|
||||||
printf(" -r Read only\n");
|
printf(" -r Read only\n");
|
||||||
printf(" -o FILE Export scanned directory to FILE\n");
|
printf(" -o FILE Export scanned directory to FILE\n");
|
||||||
printf(" -f FILE Import scanned directory from FILE\n");
|
printf(" -f FILE Import scanned directory from FILE\n");
|
||||||
printf(" -0,-1,-2 UI to use when scanning (0=none,2=full ncurses)\n");
|
printf(" -0,-1,-2,-3 UI to use when scanning (0=none,2=full ncurses,3=browse while scanning)\n");
|
||||||
printf(" --si Use base 10 (SI) prefixes instead of base 2\n");
|
printf(" --si Use base 10 (SI) prefixes instead of base 2\n");
|
||||||
printf(" --exclude PATTERN Exclude files that match PATTERN\n");
|
printf(" --exclude PATTERN Exclude files that match PATTERN\n");
|
||||||
printf(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n");
|
printf(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n");
|
||||||
|
|
@ -182,6 +183,7 @@ static void argv_parse(int argc, char **argv) {
|
||||||
case '0': dir_ui = 0; break;
|
case '0': dir_ui = 0; break;
|
||||||
case '1': dir_ui = 1; break;
|
case '1': dir_ui = 1; break;
|
||||||
case '2': dir_ui = 2; break;
|
case '2': dir_ui = 2; break;
|
||||||
|
case '3': dir_ui = 3; break;
|
||||||
case 'Q': confirm_quit = 1; break;
|
case 'Q': confirm_quit = 1; break;
|
||||||
case 1 : exclude_add(val); break; /* --exclude */
|
case 1 : exclude_add(val); break; /* --exclude */
|
||||||
case 'X':
|
case 'X':
|
||||||
|
|
@ -295,7 +297,7 @@ int main(int argc, char **argv) {
|
||||||
read_locale();
|
read_locale();
|
||||||
argv_parse(argc, argv);
|
argv_parse(argc, argv);
|
||||||
|
|
||||||
if(dir_ui == 2)
|
if(dir_ui == 2 || dir_ui == 3)
|
||||||
init_nc();
|
init_nc();
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue