mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Refactor plugin handling
This commit is contained in:
parent
d723299df6
commit
3c28d1f1d7
|
@ -11,5 +11,5 @@ CheckOptions:
|
||||||
- key: fuchsia-restrict-system-includes.Includes
|
- key: fuchsia-restrict-system-includes.Includes
|
||||||
value: '*,-stdint.h,-stdbool.h'
|
value: '*,-stdint.h,-stdbool.h'
|
||||||
- key: readability-function-size.StatementThreshold
|
- key: readability-function-size.StatementThreshold
|
||||||
value: '950'
|
value: '900'
|
||||||
...
|
...
|
||||||
|
|
52
src/nnn.c
52
src/nnn.c
|
@ -4956,8 +4956,6 @@ nochange:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sel == SEL_PLUGKEY) {
|
if (sel == SEL_PLUGKEY) {
|
||||||
uchar flag = F_NORMAL;
|
|
||||||
|
|
||||||
r = get_input("");
|
r = get_input("");
|
||||||
tmp = get_kv_val(plug, NULL, r, PLUGIN_MAX, FALSE);
|
tmp = get_kv_val(plug, NULL, r, PLUGIN_MAX, FALSE);
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
|
@ -4965,9 +4963,8 @@ nochange:
|
||||||
|
|
||||||
if (tmp[0] == '_' && tmp[1]) {
|
if (tmp[0] == '_' && tmp[1]) {
|
||||||
xstrlcpy(newpath, ++tmp, PATH_MAX);
|
xstrlcpy(newpath, ++tmp, PATH_MAX);
|
||||||
flag = F_CLI | F_CONFIRM;
|
|
||||||
spawn(newpath, (ndents ? dents[cur].name : NULL),
|
spawn(newpath, (ndents ? dents[cur].name : NULL),
|
||||||
NULL, path, flag);
|
NULL, path, F_CLI | F_CONFIRM);
|
||||||
} else {
|
} else {
|
||||||
xstrlcpy(rundir, path, PATH_MAX);
|
xstrlcpy(rundir, path, PATH_MAX);
|
||||||
xstrlcpy(path, plugindir, PATH_MAX);
|
xstrlcpy(path, plugindir, PATH_MAX);
|
||||||
|
@ -4978,33 +4975,30 @@ nochange:
|
||||||
goto nochange;
|
goto nochange;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
setdirwatch();
|
cfg.runplugin ^= 1;
|
||||||
goto begin;
|
if (!cfg.runplugin && rundir[0]) {
|
||||||
}
|
/*
|
||||||
|
* If toggled, and still in the plugin dir,
|
||||||
cfg.runplugin ^= 1;
|
* switch to original directory
|
||||||
if (!cfg.runplugin && rundir[0]) {
|
*/
|
||||||
/*
|
if (strcmp(path, plugindir) == 0) {
|
||||||
* If toggled, and still in the plugin dir,
|
xstrlcpy(path, rundir, PATH_MAX);
|
||||||
* switch to original directory
|
xstrlcpy(lastname, runfile, NAME_MAX);
|
||||||
*/
|
rundir[0] = runfile[0] = '\0';
|
||||||
if (strcmp(path, plugindir) == 0) {
|
setdirwatch();
|
||||||
xstrlcpy(path, rundir, PATH_MAX);
|
goto begin;
|
||||||
xstrlcpy(lastname, runfile, NAME_MAX);
|
}
|
||||||
rundir[0] = runfile[0] = '\0';
|
break;
|
||||||
setdirwatch();
|
|
||||||
goto begin;
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
xstrlcpy(rundir, path, PATH_MAX);
|
xstrlcpy(rundir, path, PATH_MAX);
|
||||||
xstrlcpy(path, plugindir, PATH_MAX);
|
xstrlcpy(path, plugindir, PATH_MAX);
|
||||||
if (ndents)
|
if (ndents)
|
||||||
xstrlcpy(runfile, dents[cur].name, NAME_MAX);
|
xstrlcpy(runfile, dents[cur].name, NAME_MAX);
|
||||||
cfg.runctx = cfg.curctx;
|
cfg.runctx = cfg.curctx;
|
||||||
lastname[0] = '\0';
|
lastname[0] = '\0';
|
||||||
|
}
|
||||||
setdirwatch();
|
setdirwatch();
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_LAUNCH:
|
case SEL_LAUNCH:
|
||||||
|
|
Loading…
Reference in a new issue