Преглед изворни кода

Use test and set in frequent keys

master
Arun Prakash Jana пре 5 година
родитељ
комит
0d07e45efb
No known key found for this signature in database GPG Key ID: A75979F35C080412
1 измењених фајлова са 21 додато и 7 уклоњено
  1. +21
    -7
      src/nnn.c

+ 21
- 7
src/nnn.c Прегледај датотеку

@@ -1810,6 +1810,12 @@ static int visible_str(const fltrexp_t *fltrexp, const char *fname)


static int (*filterfn)(const fltrexp_t *fltr, const char *fname) = &visible_str; static int (*filterfn)(const fltrexp_t *fltr, const char *fname) = &visible_str;


static void clearfilter()
{
if (g_ctx[cfg.curctx].c_fltr[1])
g_ctx[cfg.curctx].c_fltr[1] = 0;
}

static int entrycmp(const void *va, const void *vb) static int entrycmp(const void *va, const void *vb)
{ {
const struct entry *pa = (pEntry)va; const struct entry *pa = (pEntry)va;
@@ -1883,6 +1889,10 @@ static int nextsel(int presel)
c = getch(); c = getch();
//DPRINTF_D(c); //DPRINTF_D(c);


/* Clear previous filter when manually starting */
if (c == FILTER)
clearfilter();

if (presel == MSGWAIT) { if (presel == MSGWAIT) {
if (cfg.filtermode) if (cfg.filtermode)
c = FILTER; c = FILTER;
@@ -4371,7 +4381,7 @@ nochange:


/* Save history */ /* Save history */
xstrlcpy(lastname, xbasename(path), NAME_MAX + 1); xstrlcpy(lastname, xbasename(path), NAME_MAX + 1);
g_ctx[cfg.curctx].c_fltr[1] = '\0'; clearfilter();


xstrlcpy(path, dir, PATH_MAX); xstrlcpy(path, dir, PATH_MAX);


@@ -4396,7 +4406,7 @@ nochange:


/* Toggle filter mode on left click on last 2 lines */ /* Toggle filter mode on left click on last 2 lines */
if (event.y >= xlines - 2 && event.bstate == BUTTON1_PRESSED) { if (event.y >= xlines - 2 && event.bstate == BUTTON1_PRESSED) {
g_ctx[cfg.curctx].c_fltr[1] = '\0'; clearfilter();
cfg.filtermode ^= 1; cfg.filtermode ^= 1;
if (cfg.filtermode) { if (cfg.filtermode) {
presel = FILTER; presel = FILTER;
@@ -4464,7 +4474,8 @@ nochange:
xstrlcpy(lastdir, path, PATH_MAX); xstrlcpy(lastdir, path, PATH_MAX);


xstrlcpy(path, newpath, PATH_MAX); xstrlcpy(path, newpath, PATH_MAX);
lastname[0] = g_ctx[cfg.curctx].c_fltr[1] = '\0'; lastname[0] = '\0';
clearfilter();
setdirwatch(); setdirwatch();
goto begin; goto begin;
case S_IFREG: case S_IFREG:
@@ -4500,7 +4511,7 @@ nochange:


if (runfile[0]) if (runfile[0])
runfile[0] = '\0'; runfile[0] = '\0';
g_ctx[cfg.curctx].c_fltr[1] = '\0'; clearfilter();


setdirwatch(); setdirwatch();
goto begin; goto begin;
@@ -4588,7 +4599,8 @@ nochange:
xstrlcpy(lastdir, path, PATH_MAX); xstrlcpy(lastdir, path, PATH_MAX);


xstrlcpy(path, newpath, PATH_MAX); xstrlcpy(path, newpath, PATH_MAX);
lastname[0] = g_ctx[cfg.curctx].c_fltr[1] = '\0'; lastname[0] = '\0';
clearfilter();
DPRINTF_S(path); DPRINTF_S(path);
setdirwatch(); setdirwatch();
goto begin; goto begin;
@@ -4688,7 +4700,8 @@ nochange:
if (strcmp(path, newpath) == 0) if (strcmp(path, newpath) == 0)
break; break;


lastname[0] = g_ctx[cfg.curctx].c_fltr[1] = '\0'; lastname[0] = '\0';
clearfilter();


/* Save last working directory */ /* Save last working directory */
xstrlcpy(lastdir, path, PATH_MAX); xstrlcpy(lastdir, path, PATH_MAX);
@@ -4740,6 +4753,7 @@ nochange:
cfg.filtermode ^= 1; cfg.filtermode ^= 1;
if (cfg.filtermode) { if (cfg.filtermode) {
presel = FILTER; presel = FILTER;
clearfilter();
goto nochange; goto nochange;
} }


@@ -5299,7 +5313,7 @@ nochange:
lastname[0] = '\0'; lastname[0] = '\0';
} }
setdirwatch(); setdirwatch();
g_ctx[cfg.curctx].c_fltr[1] = 0; clearfilter();
goto begin; goto begin;
case SEL_LAUNCH: case SEL_LAUNCH:
launch_app(path, newpath); launch_app(path, newpath);


||||||
x
 
000:0
Loading…
Откажи
Сачувај