|
@@ -887,6 +887,21 @@ static bool listselfile(void) |
|
|
return TRUE; |
|
|
return TRUE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Finish selection procedure before an operation */ |
|
|
|
|
|
static void endselection(void) |
|
|
|
|
|
{ |
|
|
|
|
|
if (!cfg.selmode) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
cfg.selmode = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (selbufpos) { /* File path(s) written to the buffer */ |
|
|
|
|
|
writesel(pselbuf, selbufpos - 1); /* Truncate NULL from end */ |
|
|
|
|
|
spawn(copier, NULL, NULL, NULL, F_NOTRACE); |
|
|
|
|
|
selbufpos = 0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static bool selsafe(void) |
|
|
static bool selsafe(void) |
|
|
{ |
|
|
{ |
|
|
/* Fail if selection file path not generated */ |
|
|
/* Fail if selection file path not generated */ |
|
@@ -895,12 +910,6 @@ static bool selsafe(void) |
|
|
return FALSE; |
|
|
return FALSE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* Warn if selection not completed */ |
|
|
|
|
|
if (cfg.selmode) { |
|
|
|
|
|
printmsg("finish selection first"); |
|
|
|
|
|
return FALSE; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Fail if selection file path isn't accessible */ |
|
|
/* Fail if selection file path isn't accessible */ |
|
|
if (access(g_selpath, R_OK | W_OK) == -1) { |
|
|
if (access(g_selpath, R_OK | W_OK) == -1) { |
|
|
errno == ENOENT ? printmsg(messages[NONE_SELECTED]) : printwarn(NULL); |
|
|
errno == ENOENT ? printmsg(messages[NONE_SELECTED]) : printwarn(NULL); |
|
@@ -3998,7 +4007,7 @@ nochange: |
|
|
if (!ndents) |
|
|
if (!ndents) |
|
|
break; // fallthrough |
|
|
break; // fallthrough |
|
|
case SEL_REDRAW: // fallthrough |
|
|
case SEL_REDRAW: // fallthrough |
|
|
case SEL_RENAMEALL: // fallthrough |
|
|
|
|
|
|
|
|
case SEL_RENAMEMUL: // fallthrough |
|
|
case SEL_HELP: // fallthrough |
|
|
case SEL_HELP: // fallthrough |
|
|
case SEL_LOCK: |
|
|
case SEL_LOCK: |
|
|
{ |
|
|
{ |
|
@@ -4017,7 +4026,9 @@ nochange: |
|
|
if (ndents) |
|
|
if (ndents) |
|
|
copycurname(); |
|
|
copycurname(); |
|
|
goto begin; |
|
|
goto begin; |
|
|
case SEL_RENAMEALL: |
|
|
|
|
|
|
|
|
case SEL_RENAMEMUL: |
|
|
|
|
|
endselection(); |
|
|
|
|
|
|
|
|
if (!batch_rename(path)) { |
|
|
if (!batch_rename(path)) { |
|
|
printwait("batch rename failed", &presel); |
|
|
printwait("batch rename failed", &presel); |
|
|
goto nochange; |
|
|
goto nochange; |
|
@@ -4185,6 +4196,8 @@ nochange: |
|
|
case SEL_MV: |
|
|
case SEL_MV: |
|
|
case SEL_RMMUL: |
|
|
case SEL_RMMUL: |
|
|
{ |
|
|
{ |
|
|
|
|
|
endselection(); |
|
|
|
|
|
|
|
|
if (!selsafe()) { |
|
|
if (!selsafe()) { |
|
|
presel = MSGWAIT; |
|
|
presel = MSGWAIT; |
|
|
goto nochange; |
|
|
goto nochange; |
|
@@ -4242,10 +4255,13 @@ nochange: |
|
|
case SEL_ARCHIVE: |
|
|
case SEL_ARCHIVE: |
|
|
r = get_input("archive selection (else current)? [y/Y confirms]"); |
|
|
r = get_input("archive selection (else current)? [y/Y confirms]"); |
|
|
if (r == 'y' || r == 'Y') { |
|
|
if (r == 'y' || r == 'Y') { |
|
|
|
|
|
endselection(); |
|
|
|
|
|
|
|
|
if (!selsafe()) { |
|
|
if (!selsafe()) { |
|
|
presel = MSGWAIT; |
|
|
presel = MSGWAIT; |
|
|
goto nochange; |
|
|
goto nochange; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
tmp = NULL; |
|
|
tmp = NULL; |
|
|
} else if (!ndents) { |
|
|
} else if (!ndents) { |
|
|
printwait("no files", &presel); |
|
|
printwait("no files", &presel); |
|
@@ -4409,6 +4425,8 @@ nochange: |
|
|
case SEL_PLUGIN: // fallthrough |
|
|
case SEL_PLUGIN: // fallthrough |
|
|
case SEL_LAUNCH: // fallthrough |
|
|
case SEL_LAUNCH: // fallthrough |
|
|
case SEL_RUNCMD: |
|
|
case SEL_RUNCMD: |
|
|
|
|
|
endselection(); |
|
|
|
|
|
|
|
|
switch (sel) { |
|
|
switch (sel) { |
|
|
case SEL_EXEC: |
|
|
case SEL_EXEC: |
|
|
if (!execute_file(cur, path, newpath, &presel)) |
|
|
if (!execute_file(cur, path, newpath, &presel)) |
|
|