mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Remove redundant structure member
This commit is contained in:
parent
45ce06cc8d
commit
60de561b07
|
@ -131,7 +131,7 @@ Stripped binary (or script) size and memory usage of `nnn` and some other simila
|
||||||
<b> 1M</b> 50496 <b>15328</b> 4076 S 0.2 vifm
|
<b> 1M</b> 50496 <b>15328</b> 4076 S 0.2 vifm
|
||||||
<b> 1M</b> 72152 <b>12468</b> 7336 S 0.2 mc
|
<b> 1M</b> 72152 <b>12468</b> 7336 S 0.2 mc
|
||||||
<b> 70K</b> 16068 <b> 4620</b> 2408 S 0.1 ncdu
|
<b> 70K</b> 16068 <b> 4620</b> 2408 S 0.1 ncdu
|
||||||
<b> 60K</b> 15748 <b> 4396</b> 2516 S 0.1 nnn -S
|
<b> 55K</b> 15748 <b> 4396</b> 2516 S 0.1 nnn -S
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
Intrigued? Find out [HOW](https://github.com/jarun/nnn/wiki/performance-factors).
|
Intrigued? Find out [HOW](https://github.com/jarun/nnn/wiki/performance-factors).
|
||||||
|
|
12
src/nnn.c
12
src/nnn.c
|
@ -1127,8 +1127,6 @@ static int nextsel(char **run, char **env, int *presel)
|
||||||
|
|
||||||
for (i = 0; i < len; ++i)
|
for (i = 0; i < len; ++i)
|
||||||
if (c == bindings[i].sym) {
|
if (c == bindings[i].sym) {
|
||||||
*run = bindings[i].run;
|
|
||||||
*env = bindings[i].env;
|
|
||||||
return bindings[i].act;
|
return bindings[i].act;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2974,10 +2972,14 @@ nochange:
|
||||||
|
|
||||||
mkpath(path, dents[cur].name, newpath, PATH_MAX);
|
mkpath(path, dents[cur].name, newpath, PATH_MAX);
|
||||||
|
|
||||||
if (sel == SEL_MEDIA || sel == SEL_FMEDIA)
|
if (sel == SEL_MEDIA)
|
||||||
r = show_mediainfo(newpath, run);
|
r = show_mediainfo(newpath, NULL);
|
||||||
|
else if (sel == SEL_FMEDIA)
|
||||||
|
r = show_mediainfo(newpath, "-f");
|
||||||
|
else if (sel == SEL_LIST)
|
||||||
|
r = handle_archive(newpath, "-l", path);
|
||||||
else
|
else
|
||||||
r = handle_archive(newpath, run, path);
|
r = handle_archive(newpath, "-x", path);
|
||||||
|
|
||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
xstrlcpy(newpath, "missing ", PATH_MAX);
|
xstrlcpy(newpath, "missing ", PATH_MAX);
|
||||||
|
|
165
src/nnn.h
165
src/nnn.h
|
@ -94,8 +94,6 @@ enum action {
|
||||||
struct key {
|
struct key {
|
||||||
int sym; /* Key pressed */
|
int sym; /* Key pressed */
|
||||||
enum action act; /* Action */
|
enum action act; /* Action */
|
||||||
char *run; /* Program to run or program option */
|
|
||||||
char *env; /* Environment variable to run */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Extension pattern and mime combination */
|
/* Extension pattern and mime combination */
|
||||||
|
@ -110,133 +108,134 @@ static struct assoc assocs[] = {
|
||||||
|
|
||||||
static struct key bindings[] = {
|
static struct key bindings[] = {
|
||||||
/* Back */
|
/* Back */
|
||||||
{ KEY_BACKSPACE, SEL_BACK, "", "" },
|
{ KEY_BACKSPACE, SEL_BACK },
|
||||||
{ '\b' /* BS */, SEL_BACK, "", "" },
|
{ '\b' /* BS */, SEL_BACK },
|
||||||
{ 127 /* DEL */, SEL_BACK, "", "" },
|
{ 127 /* DEL */, SEL_BACK },
|
||||||
{ KEY_LEFT, SEL_BACK, "", "" },
|
{ KEY_LEFT, SEL_BACK },
|
||||||
{ 'h', SEL_BACK, "", "" },
|
{ 'h', SEL_BACK },
|
||||||
{ CONTROL('H'), SEL_BACK, "", "" },
|
{ CONTROL('H'), SEL_BACK },
|
||||||
/* Inside */
|
/* Inside or select */
|
||||||
{ KEY_ENTER, SEL_GOIN, "", "" },
|
{ KEY_ENTER, SEL_GOIN },
|
||||||
{ '\r', SEL_GOIN, "", "" },
|
{ '\r', SEL_GOIN },
|
||||||
{ KEY_RIGHT, SEL_NAV_IN, "", "" },
|
/* Pure navigate inside */
|
||||||
{ 'l', SEL_NAV_IN, "", "" },
|
{ KEY_RIGHT, SEL_NAV_IN },
|
||||||
|
{ 'l', SEL_NAV_IN },
|
||||||
/* Next */
|
/* Next */
|
||||||
{ 'j', SEL_NEXT, "", "" },
|
{ 'j', SEL_NEXT },
|
||||||
{ KEY_DOWN, SEL_NEXT, "", "" },
|
{ KEY_DOWN, SEL_NEXT },
|
||||||
{ CONTROL('N'), SEL_NEXT, "", "" },
|
{ CONTROL('N'), SEL_NEXT },
|
||||||
/* Previous */
|
/* Previous */
|
||||||
{ 'k', SEL_PREV, "", "" },
|
{ 'k', SEL_PREV },
|
||||||
{ KEY_UP, SEL_PREV, "", "" },
|
{ KEY_UP, SEL_PREV },
|
||||||
{ CONTROL('P'), SEL_PREV, "", "" },
|
{ CONTROL('P'), SEL_PREV },
|
||||||
/* Page down */
|
/* Page down */
|
||||||
{ KEY_NPAGE, SEL_PGDN, "", "" },
|
{ KEY_NPAGE, SEL_PGDN },
|
||||||
{ CONTROL('D'), SEL_PGDN, "", "" },
|
{ CONTROL('D'), SEL_PGDN },
|
||||||
/* Page up */
|
/* Page up */
|
||||||
{ KEY_PPAGE, SEL_PGUP, "", "" },
|
{ KEY_PPAGE, SEL_PGUP },
|
||||||
{ CONTROL('U'), SEL_PGUP, "", "" },
|
{ CONTROL('U'), SEL_PGUP },
|
||||||
/* First entry */
|
/* First entry */
|
||||||
{ KEY_HOME, SEL_HOME, "", "" },
|
{ KEY_HOME, SEL_HOME },
|
||||||
{ 'g', SEL_HOME, "", "" },
|
{ 'g', SEL_HOME },
|
||||||
{ CONTROL('A'), SEL_HOME, "", "" },
|
{ CONTROL('A'), SEL_HOME },
|
||||||
{ '^', SEL_HOME, "", "" },
|
{ '^', SEL_HOME },
|
||||||
/* Last entry */
|
/* Last entry */
|
||||||
{ KEY_END, SEL_END, "", "" },
|
{ KEY_END, SEL_END },
|
||||||
{ 'G', SEL_END, "", "" },
|
{ 'G', SEL_END },
|
||||||
{ CONTROL('E'), SEL_END, "", "" },
|
{ CONTROL('E'), SEL_END },
|
||||||
{ '$', SEL_END, "", "" },
|
{ '$', SEL_END },
|
||||||
/* HOME */
|
/* HOME */
|
||||||
{ '~', SEL_CDHOME, "", "" },
|
{ '~', SEL_CDHOME },
|
||||||
/* Initial directory */
|
/* Initial directory */
|
||||||
{ '&', SEL_CDBEGIN, "", "" },
|
{ '&', SEL_CDBEGIN },
|
||||||
/* Last visited dir */
|
/* Last visited dir */
|
||||||
{ '-', SEL_CDLAST, "", "" },
|
{ '-', SEL_CDLAST },
|
||||||
/* Leader key */
|
/* Leader key */
|
||||||
{ CONTROL('_'), SEL_LEADER, "", "" },
|
{ CONTROL('_'), SEL_LEADER },
|
||||||
{ '`', SEL_LEADER, "", "" },
|
{ '`', SEL_LEADER },
|
||||||
/* Cycle contexts in forward direction */
|
/* Cycle contexts in forward direction */
|
||||||
{ '\t', SEL_CYCLE, "", "" },
|
{ '\t', SEL_CYCLE },
|
||||||
{ CONTROL('T'), SEL_CYCLE, "", "" },
|
{ CONTROL('T'), SEL_CYCLE },
|
||||||
/* Mark a path to visit later */
|
/* Mark a path to visit later */
|
||||||
{ 'b', SEL_PIN, "", "" },
|
{ 'b', SEL_PIN },
|
||||||
/* Visit marked directory */
|
/* Visit marked directory */
|
||||||
{ CONTROL('W'), SEL_VISIT, "", "" },
|
{ CONTROL('W'), SEL_VISIT },
|
||||||
/* Filter */
|
/* Filter */
|
||||||
{ '/', SEL_FLTR, "", "" },
|
{ '/', SEL_FLTR },
|
||||||
/* Toggle filter mode */
|
/* Toggle filter mode */
|
||||||
{ KEY_IC, SEL_MFLTR, "", "" },
|
{ KEY_IC, SEL_MFLTR },
|
||||||
{ CONTROL('I'), SEL_MFLTR, "", "" },
|
{ CONTROL('I'), SEL_MFLTR },
|
||||||
/* Toggle hide .dot files */
|
/* Toggle hide .dot files */
|
||||||
{ '.', SEL_TOGGLEDOT, "", "" },
|
{ '.', SEL_TOGGLEDOT },
|
||||||
/* Detailed listing */
|
/* Detailed listing */
|
||||||
{ 'd', SEL_DETAIL, "", "" },
|
{ 'd', SEL_DETAIL },
|
||||||
/* File details */
|
/* File details */
|
||||||
{ 'D', SEL_STATS, "", "" },
|
{ 'D', SEL_STATS },
|
||||||
/* Show media info short, run is hacked */
|
/* Show media info short, run is hacked */
|
||||||
{ 'm', SEL_MEDIA, NULL, "" },
|
{ 'm', SEL_MEDIA },
|
||||||
/* Show media info full, run is hacked */
|
/* Show media info full, run is hacked */
|
||||||
{ 'M', SEL_FMEDIA, "-f", "" },
|
{ 'M', SEL_FMEDIA },
|
||||||
/* Launch a GUI application */
|
/* Launch a GUI application */
|
||||||
{ 'o', SEL_LAUNCH, "", "" },
|
{ 'o', SEL_LAUNCH },
|
||||||
/* Create archive */
|
/* Create archive */
|
||||||
{ 'f', SEL_ARCHIVE, "", "" },
|
{ 'f', SEL_ARCHIVE },
|
||||||
/* List archive */
|
/* List archive */
|
||||||
{ 'F', SEL_LIST, "-l", "" },
|
{ 'F', SEL_LIST },
|
||||||
/* Extract archive */
|
/* Extract archive */
|
||||||
{ CONTROL('F'), SEL_EXTRACT, "-x", "" },
|
{ CONTROL('F'), SEL_EXTRACT },
|
||||||
/* Toggle sort by size */
|
/* Toggle sort by size */
|
||||||
{ 's', SEL_FSIZE, "", "" },
|
{ 's', SEL_FSIZE },
|
||||||
/* Sort by apparent size including dir contents */
|
/* Sort by apparent size including dir contents */
|
||||||
{ 'S', SEL_ASIZE, "", "" },
|
{ 'S', SEL_ASIZE },
|
||||||
/* Sort by total block count including dir contents */
|
/* Sort by total block count including dir contents */
|
||||||
{ CONTROL('J'), SEL_BSIZE, "", "" },
|
{ CONTROL('J'), SEL_BSIZE },
|
||||||
/* Toggle sort by time */
|
/* Toggle sort by time */
|
||||||
{ 't', SEL_MTIME, "", "" },
|
{ 't', SEL_MTIME },
|
||||||
/* Redraw window */
|
/* Redraw window */
|
||||||
{ CONTROL('L'), SEL_REDRAW, "", "" },
|
{ CONTROL('L'), SEL_REDRAW },
|
||||||
{ KEY_F(5), SEL_REDRAW, "", "" }, /* Undocumented */
|
{ KEY_F(5), SEL_REDRAW }, /* Undocumented */
|
||||||
/* Copy currently selected file path */
|
/* Copy currently selected file path */
|
||||||
{ CONTROL('K'), SEL_COPY, "", "" },
|
{ CONTROL('K'), SEL_COPY },
|
||||||
{ ' ', SEL_COPY, "", "" },
|
{ ' ', SEL_COPY },
|
||||||
/* Toggle copy multiple file paths */
|
/* Toggle copy multiple file paths */
|
||||||
{ CONTROL('Y'), SEL_COPYMUL, "", "" },
|
{ CONTROL('Y'), SEL_COPYMUL },
|
||||||
{ 'Y', SEL_COPYMUL, "", "" },
|
{ 'Y', SEL_COPYMUL },
|
||||||
/* Show list of copied files */
|
/* Show list of copied files */
|
||||||
{ 'y', SEL_COPYLIST, "", "" },
|
{ 'y', SEL_COPYLIST },
|
||||||
/* Copy from copy buffer */
|
/* Copy from copy buffer */
|
||||||
{ 'P', SEL_CP, "", "" },
|
{ 'P', SEL_CP },
|
||||||
/* Move from copy buffer */
|
/* Move from copy buffer */
|
||||||
{ 'V', SEL_MV, "", "" },
|
{ 'V', SEL_MV },
|
||||||
/* Delete from copy buffer */
|
/* Delete from copy buffer */
|
||||||
{ 'X', SEL_RMMUL, "", "" },
|
{ 'X', SEL_RMMUL },
|
||||||
/* Delete currently selected */
|
/* Delete currently selected */
|
||||||
{ CONTROL('X'), SEL_RM, "", "" },
|
{ CONTROL('X'), SEL_RM },
|
||||||
/* Open in a custom application */
|
/* Open in a custom application */
|
||||||
{ CONTROL('O'), SEL_OPEN, "", "" },
|
{ CONTROL('O'), SEL_OPEN },
|
||||||
/* Create a new file */
|
/* Create a new file */
|
||||||
{ 'n', SEL_NEW, "", "" },
|
{ 'n', SEL_NEW },
|
||||||
/* Show rename prompt */
|
/* Show rename prompt */
|
||||||
{ CONTROL('R'), SEL_RENAME, "", "" },
|
{ CONTROL('R'), SEL_RENAME },
|
||||||
{ KEY_F(2), SEL_RENAME, "", "" }, /* Undocumented */
|
{ KEY_F(2), SEL_RENAME }, /* Undocumented */
|
||||||
/* Rename contents of current dir */
|
/* Rename contents of current dir */
|
||||||
{ 'r', SEL_RENAMEALL, "", "" },
|
{ 'r', SEL_RENAMEALL },
|
||||||
/* Show help */
|
/* Show help */
|
||||||
{ '?', SEL_HELP, "", "" },
|
{ '?', SEL_HELP },
|
||||||
/* Run command */
|
/* Run command */
|
||||||
{ '!', SEL_RUN, "", "" },
|
{ '!', SEL_RUN },
|
||||||
{ CONTROL(']'), SEL_RUN, "", "" },
|
{ CONTROL(']'), SEL_RUN },
|
||||||
/* Run a custom script */
|
/* Run a custom script */
|
||||||
{ 'R', SEL_RUNSCRIPT, "", "" },
|
{ 'R', SEL_RUNSCRIPT },
|
||||||
/* Run command with argument */
|
/* Run command with argument */
|
||||||
{ 'e', SEL_RUNEDIT, "", "" },
|
{ 'e', SEL_RUNEDIT },
|
||||||
{ 'p', SEL_RUNPAGE, "", "" },
|
{ 'p', SEL_RUNPAGE },
|
||||||
/* Lock screen */
|
/* Lock screen */
|
||||||
{ 'L', SEL_LOCK, "", "" },
|
{ 'L', SEL_LOCK },
|
||||||
/* Quit a context */
|
/* Quit a context */
|
||||||
{ 'q', SEL_QUITCTX, "", "" },
|
{ 'q', SEL_QUITCTX },
|
||||||
/* Change dir on quit */
|
/* Change dir on quit */
|
||||||
{ CONTROL('G'), SEL_QUITCD, "", "" },
|
{ CONTROL('G'), SEL_QUITCD },
|
||||||
/* Quit */
|
/* Quit */
|
||||||
{ 'Q', SEL_QUIT, "", "" },
|
{ 'Q', SEL_QUIT },
|
||||||
{ CONTROL('Q'), SEL_QUIT, "", "" },
|
{ CONTROL('Q'), SEL_QUIT },
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue