mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Split out default filter initialization
This commit is contained in:
parent
dd29e81df5
commit
45e6fafc47
14
noice.c
14
noice.c
|
@ -238,6 +238,12 @@ setfilter(regex_t *regex, char *filter)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
initfilter(int dot, char **ifilter)
|
||||||
|
{
|
||||||
|
*ifilter = dot ? "." : "^[^.]";
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
visible(regex_t *regex, char *file)
|
visible(regex_t *regex, char *file)
|
||||||
{
|
{
|
||||||
|
@ -734,7 +740,7 @@ nochange:
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_TOGGLEDOT:
|
case SEL_TOGGLEDOT:
|
||||||
showhidden ^= 1;
|
showhidden ^= 1;
|
||||||
ifilter = showhidden ? "." : "^[^.]";
|
initfilter(showhidden, &ifilter);
|
||||||
strlcpy(fltr, ifilter, sizeof(fltr));
|
strlcpy(fltr, ifilter, sizeof(fltr));
|
||||||
goto begin;
|
goto begin;
|
||||||
case SEL_MTIME:
|
case SEL_MTIME:
|
||||||
|
@ -795,11 +801,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
if (getuid() == 0)
|
if (getuid() == 0)
|
||||||
showhidden = 1;
|
showhidden = 1;
|
||||||
|
initfilter(showhidden, &ifilter);
|
||||||
if (showhidden)
|
|
||||||
ifilter = ".";
|
|
||||||
else
|
|
||||||
ifilter = "^[^.]";
|
|
||||||
|
|
||||||
if (argv[1] != NULL) {
|
if (argv[1] != NULL) {
|
||||||
ipath = argv[1];
|
ipath = argv[1];
|
||||||
|
|
Loading…
Reference in a new issue