aboutsummaryrefslogtreecommitdiffstats
path: root/noice.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2016-08-22 13:44:52 +0100
committersin <sin@2f30.org>2016-08-22 14:07:07 +0100
commitdd29e81df5e3aa917bb89d13282c3ba38f458a3f (patch)
tree6abe322b3a15d40569b3b6a55027de7b3f3b6fdb /noice.c
parentbd79c29d8b3f4605de38a034fd24cf847dfa5273 (diff)
downloadnoice-dd29e81df5e3aa917bb89d13282c3ba38f458a3f.tar.gz
Make toggle dot behaviour persistent
Once set, the default filter is updated. This means that toggle dot will also work as expected when noice is executed as root. Based on discussion with Ypnose.
Diffstat (limited to 'noice.c')
-rw-r--r--noice.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/noice.c b/noice.c
index a588a55..0d5627d 100644
--- a/noice.c
+++ b/noice.c
@@ -733,10 +733,9 @@ nochange:
DPRINTF_S(path);
goto begin;
case SEL_TOGGLEDOT:
- if (strcmp(fltr, ifilter) != 0)
- strlcpy(fltr, ifilter, sizeof(fltr));
- else
- strlcpy(fltr, ".", sizeof(fltr));
+ showhidden ^= 1;
+ ifilter = showhidden ? "." : "^[^.]";
+ strlcpy(fltr, ifilter, sizeof(fltr));
goto begin;
case SEL_MTIME:
mtimeorder = !mtimeorder;
@@ -795,9 +794,12 @@ main(int argc, char *argv[])
}
if (getuid() == 0)
+ showhidden = 1;
+
+ if (showhidden)
ifilter = ".";
else
- ifilter = "^[^.]"; /* Hide dotfiles */
+ ifilter = "^[^.]";
if (argv[1] != NULL) {
ipath = argv[1];
Un proyecto texto-plano.xyz