mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Support >/. and </, at bookmark prompt to cycle active contexts
This commit is contained in:
parent
30dc2baa3b
commit
70f561dd71
|
@ -267,7 +267,7 @@ Contexts (aka _tabs_ aka _workspaces_) serve the purpose of exploring multiple d
|
||||||
- other used contexts are underlined
|
- other used contexts are underlined
|
||||||
- rest are unused
|
- rest are unused
|
||||||
|
|
||||||
The bookmark prompt understands contexts. To switch contexts press <kbd>^B</kbd> and enter the context number (1-4).
|
The bookmark prompt understands contexts. To switch contexts press <kbd>^B</kbd> and enter the context number (1-4). <kbd>>/.</kbd> and <kbd></.</kbd> at the bookmark prompt cycles between active contexts.
|
||||||
|
|
||||||
The first time a context is entered, it copies the state of the last visited context. Each context remembers its start directory and last visited directory.
|
The first time a context is entered, it copies the state of the last visited context. Each context remembers its start directory and last visited directory.
|
||||||
|
|
||||||
|
|
20
nnn.c
20
nnn.c
|
@ -2485,6 +2485,7 @@ static void browse(char *ipath, char *ifilter)
|
||||||
|
|
||||||
/* setup first context */
|
/* setup first context */
|
||||||
xstrlcpy(g_ctx[0].c_init, ipath, PATH_MAX);
|
xstrlcpy(g_ctx[0].c_init, ipath, PATH_MAX);
|
||||||
|
g_ctx[0].c_cfg = cfg;
|
||||||
|
|
||||||
xstrlcpy(path, ipath, PATH_MAX);
|
xstrlcpy(path, ipath, PATH_MAX);
|
||||||
copyfilter();
|
copyfilter();
|
||||||
|
@ -2751,6 +2752,20 @@ nochange:
|
||||||
case '&':
|
case '&':
|
||||||
presel = tmp[0];
|
presel = tmp[0];
|
||||||
goto begin;
|
goto begin;
|
||||||
|
case '>':
|
||||||
|
case '.':
|
||||||
|
case '<':
|
||||||
|
case ',':
|
||||||
|
r = cfg.curctx;
|
||||||
|
if (tmp[0] == '>' || tmp[0] == '.')
|
||||||
|
do
|
||||||
|
(r == MAX_CTX - 1) ? (r = 0) : ++r;
|
||||||
|
while (!g_ctx[r].c_cfg.ctxactive);
|
||||||
|
else
|
||||||
|
do
|
||||||
|
(r == 0) ? (r = MAX_CTX - 1) : --r;
|
||||||
|
while (!g_ctx[r].c_cfg.ctxactive); //fallthrough
|
||||||
|
tmp[0] = '1' + r; //fallthrough
|
||||||
case '1': //fallthrough
|
case '1': //fallthrough
|
||||||
case '2': //fallthrough
|
case '2': //fallthrough
|
||||||
case '3': //fallthrough
|
case '3': //fallthrough
|
||||||
|
@ -3298,10 +3313,7 @@ nochange:
|
||||||
uint iter = 1;
|
uint iter = 1;
|
||||||
r = cfg.curctx;
|
r = cfg.curctx;
|
||||||
while (iter < MAX_CTX) {
|
while (iter < MAX_CTX) {
|
||||||
++r;
|
(r == MAX_CTX - 1) ? (r = 0) : ++r;
|
||||||
r %= MAX_CTX;
|
|
||||||
DPRINTF_D(r);
|
|
||||||
DPRINTF_U(g_ctx[r].c_cfg.ctxactive);
|
|
||||||
if (g_ctx[r].c_cfg.ctxactive) {
|
if (g_ctx[r].c_cfg.ctxactive) {
|
||||||
g_ctx[cfg.curctx].c_cfg.ctxactive = 0;
|
g_ctx[cfg.curctx].c_cfg.ctxactive = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue