mirror of
https://github.com/jarun/nnn.git
synced 2025-01-10 09:59:56 +00:00
Update context switch logic
This commit is contained in:
parent
573c61f330
commit
c8f080f0b5
40
src/nnn.c
40
src/nnn.c
|
@ -3176,11 +3176,11 @@ nochange:
|
||||||
r = cfg.curctx;
|
r = cfg.curctx;
|
||||||
if (fd == '>' || fd == '.')
|
if (fd == '>' || fd == '.')
|
||||||
do
|
do
|
||||||
(r == CTX_MAX - 1) ? (r = 0) : ++r;
|
r = (r + 1) & ~CTX_MAX;
|
||||||
while (!g_ctx[r].c_cfg.ctxactive);
|
while (!g_ctx[r].c_cfg.ctxactive);
|
||||||
else
|
else
|
||||||
do
|
do
|
||||||
(r == 0) ? (r = CTX_MAX - 1) : --r;
|
r = (r + (CTX_MAX - 1)) & (CTX_MAX - 1);
|
||||||
while (!g_ctx[r].c_cfg.ctxactive); // fallthrough
|
while (!g_ctx[r].c_cfg.ctxactive); // fallthrough
|
||||||
fd = '1' + r; // fallthrough
|
fd = '1' + r; // fallthrough
|
||||||
case '1': // fallthrough
|
case '1': // fallthrough
|
||||||
|
@ -3919,26 +3919,28 @@ nochange:
|
||||||
presel = MSGWAIT;
|
presel = MSGWAIT;
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
} // fallthrough
|
}
|
||||||
|
|
||||||
|
dentfree(dents);
|
||||||
|
return;
|
||||||
case SEL_QUITCTX:
|
case SEL_QUITCTX:
|
||||||
if (sel == SEL_QUITCTX) {
|
fd = cfg.curctx;
|
||||||
r = cfg.curctx;
|
for (r = (fd + 1) & ~CTX_MAX;
|
||||||
for (fd = 1; fd < CTX_MAX; ++fd) {
|
(r != fd) && !g_ctx[r].c_cfg.ctxactive;
|
||||||
(r == CTX_MAX - 1) ? (r = 0) : ++r;
|
r = ((r + 1) & ~CTX_MAX));
|
||||||
if (g_ctx[r].c_cfg.ctxactive) {
|
|
||||||
g_ctx[cfg.curctx].c_cfg.ctxactive = 0;
|
|
||||||
|
|
||||||
/* Switch to next active context */
|
if (r != fd) {
|
||||||
path = g_ctx[r].c_path;
|
g_ctx[fd].c_cfg.ctxactive = 0;
|
||||||
lastdir = g_ctx[r].c_last;
|
|
||||||
lastname = g_ctx[r].c_name;
|
|
||||||
cfg = g_ctx[r].c_cfg;
|
|
||||||
|
|
||||||
cfg.curctx = r;
|
/* Switch to next active context */
|
||||||
setdirwatch();
|
path = g_ctx[r].c_path;
|
||||||
goto begin;
|
lastdir = g_ctx[r].c_last;
|
||||||
}
|
lastname = g_ctx[r].c_name;
|
||||||
}
|
cfg = g_ctx[r].c_cfg;
|
||||||
|
|
||||||
|
cfg.curctx = r;
|
||||||
|
setdirwatch();
|
||||||
|
goto begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
dentfree(dents);
|
dentfree(dents);
|
||||||
|
|
Loading…
Reference in a new issue