diff --git a/src/dir_common.c b/src/dir_common.c index 6ab12abd6e3f3b34f26c2e60253473e7a0e64022..46ebb75d5731e589517af4a61c33a961c70f2ef0 100644 --- a/src/dir_common.c +++ b/src/dir_common.c @@ -35,6 +35,7 @@ char *dir_curpath; /* Full path of the last seen item. */ struct dir_output dir_output; char *dir_fatalerr; /* Error message on a fatal error. (NULL if there was no fatal error) */ int dir_ui; /* User interface to use */ +int confirm_quit_while_scanning_stage_1_passed; /* Additional check before quitting */ static char *lasterr; /* Path where the last error occured. */ static int curpathl; /* Allocated length of dir_curpath */ static int lasterrl; /* ^ of lasterr */ @@ -134,7 +135,10 @@ static void draw_progress() { if(dir_output.size) ncprint(2, 23, "size: %s", formatsize(dir_output.size)); ncprint(3, 2, "Current item: %s", cropstr(dir_curpath, width-18)); - ncaddstr(8, width-18, "Press q to abort"); + if (confirm_quit_while_scanning_stage_1_passed) + ncaddstr(8, width-26, "Press y to confirm abort"); + else + ncaddstr(8, width-18, "Press q to abort"); /* show warning if we couldn't open a dir */ if(lasterr) { @@ -207,7 +211,16 @@ void dir_draw() { int dir_key(int ch) { if(dir_fatalerr) return 1; - if(ch == 'q') - return 1; + if(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') { + confirm_quit_while_scanning_stage_1_passed = 1; + return 0; + } return 0; } diff --git a/src/dir_scan.c b/src/dir_scan.c index 6c38eebeb994fded071003ce8025c37b8b52b589..ab140a6a3924b0fd73eb2d2e71336bcd5bfb2ea6 100644 --- a/src/dir_scan.c +++ b/src/dir_scan.c @@ -291,10 +291,13 @@ static int process() { } +extern int confirm_quit_while_scanning_stage_1_passed; + void dir_scan_init(const char *path) { dir_curpath_set(path); dir_setlasterr(NULL); dir_seterr(NULL); dir_process = process; pstate = ST_CALC; + confirm_quit_while_scanning_stage_1_passed = 0; }