mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Change order of cases in switch statement.
This commit is contained in:
parent
cc38369540
commit
55f1397cbb
49
src/nnn.c
49
src/nnn.c
|
@ -2806,11 +2806,12 @@ nochange:
|
||||||
DPRINTF_S(path);
|
DPRINTF_S(path);
|
||||||
setdirwatch();
|
setdirwatch();
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_LEADER:
|
case SEL_LEADER: // fallthrough
|
||||||
fd = get_input(NULL); // fallthrough
|
|
||||||
case SEL_CYCLE:
|
case SEL_CYCLE:
|
||||||
if (sel == SEL_CYCLE)
|
if (sel == SEL_CYCLE)
|
||||||
fd = '>';
|
fd = '>';
|
||||||
|
else
|
||||||
|
fd = get_input(NULL);
|
||||||
|
|
||||||
switch (fd) {
|
switch (fd) {
|
||||||
case 'q': // fallthrough
|
case 'q': // fallthrough
|
||||||
|
@ -2996,12 +2997,10 @@ nochange:
|
||||||
r = TRUE;
|
r = TRUE;
|
||||||
spawn(pager, pager_arg, dents[cur].name, path, F_NORMAL);
|
spawn(pager, pager_arg, dents[cur].name, path, F_NORMAL);
|
||||||
break;
|
break;
|
||||||
case SEL_LOCK:
|
default: /* SEL_LOCK */
|
||||||
r = TRUE;
|
r = TRUE;
|
||||||
spawn(utils[LOCKER], NULL, NULL, NULL, F_NORMAL | F_SIGINT);
|
spawn(utils[LOCKER], NULL, NULL, NULL, F_NORMAL | F_SIGINT);
|
||||||
break;
|
break;
|
||||||
default: /* unreachable */
|
|
||||||
goto nochange;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!r) {
|
if (!r) {
|
||||||
|
@ -3246,21 +3245,21 @@ nochange:
|
||||||
char *ptr = NULL, *ptr1 = NULL, *ptr2 = NULL;
|
char *ptr = NULL, *ptr1 = NULL, *ptr2 = NULL;
|
||||||
|
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case SEL_OPEN:
|
|
||||||
tmp = xreadline(NULL, "open with: ");
|
|
||||||
break;
|
|
||||||
case SEL_RENAME:
|
|
||||||
tmp = xreadline(dents[cur].name, "");
|
|
||||||
break;
|
|
||||||
case SEL_LAUNCH:
|
case SEL_LAUNCH:
|
||||||
tmp = xreadline(NULL, "launch: ");
|
tmp = xreadline(NULL, "launch: ");
|
||||||
break;
|
break;
|
||||||
case SEL_ARCHIVE:
|
case SEL_ARCHIVE:
|
||||||
tmp = xreadline(dents[cur].name, "name: ");
|
tmp = xreadline(dents[cur].name, "name: ");
|
||||||
break;
|
break;
|
||||||
default:
|
case SEL_OPEN:
|
||||||
|
tmp = xreadline(NULL, "open with: ");
|
||||||
|
break;
|
||||||
|
case SEL_NEW:
|
||||||
tmp = xreadline(NULL, "name: ");
|
tmp = xreadline(NULL, "name: ");
|
||||||
break;
|
break;
|
||||||
|
default: /* SEL_RENAME */
|
||||||
|
tmp = xreadline(dents[cur].name, "");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp == NULL || tmp[0] == '\0')
|
if (tmp == NULL || tmp[0] == '\0')
|
||||||
|
@ -3280,16 +3279,6 @@ nochange:
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case SEL_OPEN:
|
|
||||||
getprogarg(tmp, &ptr);
|
|
||||||
mkpath(path, dents[cur].name, newpath, PATH_MAX);
|
|
||||||
spawn(tmp, ptr, newpath, path, r);
|
|
||||||
break;
|
|
||||||
case SEL_RENAME:
|
|
||||||
/* Skip renaming to same name */
|
|
||||||
if (strcmp(tmp, dents[cur].name) == 0)
|
|
||||||
goto nochange;
|
|
||||||
break;
|
|
||||||
case SEL_LAUNCH:
|
case SEL_LAUNCH:
|
||||||
{
|
{
|
||||||
uint args = 0;
|
uint args = 0;
|
||||||
|
@ -3323,6 +3312,16 @@ nochange:
|
||||||
|
|
||||||
spawn(utils[APACK], tmp, dents[cur].name, path, F_NORMAL);
|
spawn(utils[APACK], tmp, dents[cur].name, path, F_NORMAL);
|
||||||
break;
|
break;
|
||||||
|
case SEL_OPEN:
|
||||||
|
getprogarg(tmp, &ptr);
|
||||||
|
mkpath(path, dents[cur].name, newpath, PATH_MAX);
|
||||||
|
spawn(tmp, ptr, newpath, path, r);
|
||||||
|
break;
|
||||||
|
case SEL_RENAME:
|
||||||
|
/* Skip renaming to same name */
|
||||||
|
if (strcmp(tmp, dents[cur].name) == 0)
|
||||||
|
goto nochange;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3436,12 +3435,12 @@ nochange:
|
||||||
if (S_ISDIR(sb.st_mode)) {
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
cfg.runscript ^= 1;
|
cfg.runscript ^= 1;
|
||||||
if (!cfg.runscript && rundir[0]) {
|
if (!cfg.runscript && rundir[0]) {
|
||||||
/* If toggled, switch to original directory */
|
/* If toggled, and still in the script dir,
|
||||||
|
switch to original directory */
|
||||||
if (strcmp(path, runpath) == 0) {
|
if (strcmp(path, runpath) == 0) {
|
||||||
xstrlcpy(path, rundir, PATH_MAX);
|
xstrlcpy(path, rundir, PATH_MAX);
|
||||||
xstrlcpy(lastname, runfile, NAME_MAX);
|
xstrlcpy(lastname, runfile, NAME_MAX);
|
||||||
rundir[0] = '\0';
|
rundir[0] = runfile[0] = '\0';
|
||||||
runfile[0] = '\0';
|
|
||||||
setdirwatch();
|
setdirwatch();
|
||||||
goto begin;
|
goto begin;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue