mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
MInor refactor
This commit is contained in:
parent
555492276c
commit
1029ff0d5b
19
src/nnn.c
19
src/nnn.c
|
@ -3326,27 +3326,26 @@ static void (*printptr)(const struct entry *ent, uint namecols, bool sel) = &pri
|
||||||
static void savecurctx(settings *curcfg, char *path, char *curname, int r /* next context num */)
|
static void savecurctx(settings *curcfg, char *path, char *curname, int r /* next context num */)
|
||||||
{
|
{
|
||||||
settings cfg = *curcfg;
|
settings cfg = *curcfg;
|
||||||
|
context *ctxr = &g_ctx[r];
|
||||||
bool selmode = cfg.selmode ? TRUE : FALSE;
|
bool selmode = cfg.selmode ? TRUE : FALSE;
|
||||||
|
|
||||||
/* Save current context */
|
/* Save current context */
|
||||||
xstrsncpy(g_ctx[cfg.curctx].c_name, curname, NAME_MAX + 1);
|
xstrsncpy(g_ctx[cfg.curctx].c_name, curname, NAME_MAX + 1);
|
||||||
g_ctx[cfg.curctx].c_cfg = cfg;
|
g_ctx[cfg.curctx].c_cfg = cfg;
|
||||||
|
|
||||||
if (g_ctx[r].c_cfg.ctxactive) { /* Switch to saved context */
|
if (ctxr->c_cfg.ctxactive) { /* Switch to saved context */
|
||||||
/* Switch light/detail mode */
|
/* Switch light/detail mode */
|
||||||
if (cfg.showdetail != g_ctx[r].c_cfg.showdetail)
|
if (cfg.showdetail != ctxr->c_cfg.showdetail)
|
||||||
/* set the reverse */
|
/* set the reverse */
|
||||||
printptr = cfg.showdetail ? &printent : &printent_long;
|
printptr = cfg.showdetail ? &printent : &printent_long;
|
||||||
|
|
||||||
cfg = g_ctx[r].c_cfg;
|
cfg = ctxr->c_cfg;
|
||||||
} else { /* Setup a new context from current context */
|
} else { /* Setup a new context from current context */
|
||||||
g_ctx[r].c_cfg.ctxactive = 1;
|
ctxr->c_cfg.ctxactive = 1;
|
||||||
xstrsncpy(g_ctx[r].c_path, path, PATH_MAX);
|
xstrsncpy(ctxr->c_path, path, PATH_MAX);
|
||||||
g_ctx[r].c_last[0] = '\0';
|
ctxr->c_last[0] = ctxr->c_name[0] = ctxr->c_fltr[0] = ctxr->c_fltr[1] = '\0';
|
||||||
g_ctx[r].c_name[0] = '\0';
|
ctxr->c_cfg = cfg;
|
||||||
g_ctx[r].c_fltr[0] = g_ctx[r].c_fltr[1] = '\0';
|
ctxr->c_cfg.runplugin = 0;
|
||||||
g_ctx[r].c_cfg = cfg;
|
|
||||||
g_ctx[r].c_cfg.runplugin = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Continue selection mode */
|
/* Continue selection mode */
|
||||||
|
|
Loading…
Reference in a new issue