mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-12 17:08:39 -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;
|
||||
|
||||
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;
|
||||
if (!open) {
|
||||
dirlist_open(root);
|
||||
|
|
|
|||
|
|
@ -205,6 +205,9 @@ void dir_draw() {
|
|||
else
|
||||
draw_progress();
|
||||
break;
|
||||
case 3:
|
||||
browse_draw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -212,21 +215,27 @@ void dir_draw() {
|
|||
/* This function can't be called unless dir_ui == 2
|
||||
* (Doesn't really matter either way). */
|
||||
int dir_key(int ch) {
|
||||
if(dir_fatalerr)
|
||||
return 1;
|
||||
if(confirm_quit && confirm_quit_while_scanning_stage_1_passed) {
|
||||
if (ch == 'y'|| ch == 'Y') {
|
||||
switch (dir_ui) {
|
||||
case 3:
|
||||
browse_key(ch);
|
||||
break;
|
||||
default:
|
||||
if(dir_fatalerr)
|
||||
return 1;
|
||||
} else {
|
||||
confirm_quit_while_scanning_stage_1_passed = 0;
|
||||
return 0;
|
||||
if(confirm_quit && confirm_quit_while_scanning_stage_1_passed) {
|
||||
if (ch == 'y'|| ch == 'Y') {
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
10
src/main.c
10
src/main.c
|
|
@ -52,7 +52,7 @@ static long lastupdate = 999;
|
|||
|
||||
static void screen_draw() {
|
||||
switch(pstate) {
|
||||
case ST_CALC: browse_draw(); break;
|
||||
case ST_CALC: dir_draw(); break;
|
||||
case ST_BROWSE: browse_draw(); break;
|
||||
case ST_HELP: help_draw(); break;
|
||||
case ST_SHELL: shell_draw(); break;
|
||||
|
|
@ -98,7 +98,7 @@ int input_handle(int wait) {
|
|||
continue;
|
||||
}
|
||||
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_HELP: return help_key(ch);
|
||||
case ST_DEL: return delete_key(ch);
|
||||
|
|
@ -133,6 +133,7 @@ static void argv_parse(int argc, char **argv) {
|
|||
{ '0', 0, "-0" },
|
||||
{ '1', 0, "-1" },
|
||||
{ '2', 0, "-2" },
|
||||
{ '3', 0, "-3" },
|
||||
{ 1, 1, "--exclude" },
|
||||
{ 'X', 1, "-X,--exclude-from" },
|
||||
{ 'L', 0, "-L,--follow-symlinks" },
|
||||
|
|
@ -160,7 +161,7 @@ static void argv_parse(int argc, char **argv) {
|
|||
printf(" -r Read only\n");
|
||||
printf(" -o FILE Export scanned directory to 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(" --exclude PATTERN Exclude files that match PATTERN\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 '1': dir_ui = 1; break;
|
||||
case '2': dir_ui = 2; break;
|
||||
case '3': dir_ui = 3; break;
|
||||
case 'Q': confirm_quit = 1; break;
|
||||
case 1 : exclude_add(val); break; /* --exclude */
|
||||
case 'X':
|
||||
|
|
@ -295,7 +297,7 @@ int main(int argc, char **argv) {
|
|||
read_locale();
|
||||
argv_parse(argc, argv);
|
||||
|
||||
if(dir_ui == 2)
|
||||
if(dir_ui == 2 || dir_ui == 3)
|
||||
init_nc();
|
||||
|
||||
while(1) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue