aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-12-25 12:15:03 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-12-25 12:15:03 +0530
commit1ed5febe0c298cc932a2127b8ba061fe941ea379 (patch)
treeaa541f35a3f3bb77f37d53bf62bf73875726fbc0 /src
parentd9da85a3654be58b362c1967d876893b28ba6aa6 (diff)
downloadnnn-1ed5febe0c298cc932a2127b8ba061fe941ea379.tar.gz
Fix #420: reduce Lead key to bookmark key
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c61
-rw-r--r--src/nnn.h8
2 files changed, 20 insertions, 49 deletions
diff --git a/src/nnn.c b/src/nnn.c
index a420777..a3ab353 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2127,7 +2127,7 @@ static int filterentries(char *path)
}
}
end:
- if (*ch != '\t' && *ch != CONTROL('_'))
+ if (*ch != '\t' && *ch != 27)
g_ctx[cfg.curctx].c_fltr[0] = g_ctx[cfg.curctx].c_fltr[1] = '\0';
move_cursor(cur, 0);
@@ -3474,8 +3474,8 @@ static void show_help(const char *path)
"9g ^A Top%-11cRet Right l Open\n"
"9G ^E Bottom%-18c' First file\n"
"cb Pin CWD%-16c^B Go to pinned dir\n"
- "9, ^/ Lead key%-10cN LeadN Context N\n"
- "6(Sh)Tab Cycle context%-11cd Detail view toggle\n"
+ "9, ^/ Go to bookmark%-10cd Detail view toggle\n"
+ "6(Sh)Tab Cycle context%-11cN Context N\n"
"c/ Filter%-13cIns ^N Nav-as-you-type toggle\n"
"aEsc Exit prompt%-9c^L F5 Redraw/clear prompt\n"
"c. Toggle hidden%-11c? Help, conf\n"
@@ -3496,7 +3496,7 @@ static void show_help(const char *path)
"cz Size%-20ct Time\n"
"cE Extension%-1c\n"
"1MISC\n"
- "9! ^] Shell%-17c; x Plugin key\n"
+ "9! ^] Shell%-17c; x Run plugin\n"
"cC Execute file%-9ci ^V Pick plugin\n"
"cs Manage session%-10c= Launch app\n"
"cc Connect remote%-10cu Unmount\n"
@@ -4587,7 +4587,6 @@ nochange:
DPRINTF_S(path);
setdirwatch();
goto begin;
- case SEL_LEADER: // fallthrough
case SEL_CYCLE: // fallthrough
case SEL_CYCLER: // fallthrough
case SEL_CTX1: // fallthrough
@@ -4595,43 +4594,11 @@ nochange:
case SEL_CTX3: // fallthrough
case SEL_CTX4:
switch (sel) {
- case SEL_CYCLE:
- fd = '\t';
- break;
+ case SEL_CYCLE: // fallthrough
case SEL_CYCLER:
- fd = KEY_BTAB;
- break;
- case SEL_CTX1: // fallthrough
- case SEL_CTX2: // fallthrough
- case SEL_CTX3: // fallthrough
- case SEL_CTX4:
- fd = sel - SEL_CTX1 + '1';
- break;
- default:
- xstrlcpy(g_buf, messages[MSG_BOOKMARK_KEYS], CMD_LEN_MAX);
- printkeys(bookmark, g_buf + strlen(g_buf), BM_MAX);
- printprompt(g_buf);
- fd = get_input(NULL);
- }
-
- switch (fd) {
- case '~': // fallthrough
- case '`': // fallthrough
- case '-': // fallthrough
- case '@':
- presel = fd;
- goto nochange;
- case '.':
- cfg.showhidden ^= 1;
- setdirwatch();
- if (ndents)
- copycurname();
- goto begin;
- case '\t': // fallthrough
- case KEY_BTAB:
/* visit next and previous contexts */
r = cfg.curctx;
- if (fd == '\t')
+ if (sel == SEL_CYCLE)
do
r = (r + 1) & ~CTX_MAX;
while (!g_ctx[r].c_cfg.ctxactive);
@@ -4639,12 +4606,11 @@ nochange:
do
r = (r + (CTX_MAX - 1)) & (CTX_MAX - 1);
while (!g_ctx[r].c_cfg.ctxactive);
- fd = '1' + r; // fallthrough
- case '1': // fallthrough
- case '2': // fallthrough
- case '3': // fallthrough
- case '4':
- r = fd - '1'; /* Save the next context id */
+ // fallthrough
+ default: /* SEL_CTXN */
+ if (sel >= SEL_CTX1) /* CYCLE keys are lesser in value */
+ r = sel - SEL_CTX1; /* Save the next context id */
+
if (cfg.curctx == r) {
if (sel != SEL_CYCLE)
continue;
@@ -4669,6 +4635,11 @@ nochange:
setdirwatch();
goto begin;
}
+ case SEL_BOOKMARK:
+ xstrlcpy(g_buf, messages[MSG_BOOKMARK_KEYS], CMD_LEN_MAX);
+ printkeys(bookmark, g_buf + strlen(g_buf), BM_MAX);
+ printprompt(g_buf);
+ fd = get_input(NULL);
if (!get_kv_val(bookmark, newpath, fd, BM_MAX, TRUE)) {
printwait(messages[MSG_INVALID_KEY], &presel);;
diff --git a/src/nnn.h b/src/nnn.h
index 8a495d1..0a91746 100644
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -53,13 +53,13 @@ enum action {
SEL_CDLAST,
SEL_CDROOT,
SEL_VISIT,
- SEL_LEADER,
SEL_CYCLE,
SEL_CYCLER,
SEL_CTX1,
SEL_CTX2,
SEL_CTX3,
SEL_CTX4,
+ SEL_BOOKMARK,
SEL_PIN,
SEL_FLTR,
SEL_MFLTR,
@@ -157,9 +157,6 @@ static struct key bindings[] = {
{ '`', SEL_CDROOT },
/* Visit marked directory */
{ CONTROL('B'), SEL_VISIT },
- /* Leader key */
- { CONTROL('_'), SEL_LEADER },
- { ',', SEL_LEADER },
/* Cycle contexts in forward direction */
{ '\t', SEL_CYCLE },
/* Cycle contexts in reverse direction */
@@ -169,6 +166,9 @@ static struct key bindings[] = {
{ '2', SEL_CTX2 },
{ '3', SEL_CTX3 },
{ '4', SEL_CTX4 },
+ /* Bookmark key */
+ { CONTROL('_'), SEL_BOOKMARK },
+ { ',', SEL_BOOKMARK },
/* Mark a path to visit later */
{ 'b', SEL_PIN },
/* Filter */