aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-09-28 22:18:17 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-09-28 22:18:17 +0200
commit67da8d965b568e042ad3f93a47f93f3d0c965904 (patch)
tree9d7403ca0e7528712c4063655db98e0ccfe2b9f6
parente60ffeeb206b177211249e26e2cb113e4e302d79 (diff)
downloadsdn-67da8d965b568e042ad3f93a47f93f3d0c965904.tar.gz
sdn-67da8d965b568e042ad3f93a47f93f3d0c965904.tar.xz
sdn-67da8d965b568e042ad3f93a47f93f3d0c965904.zip
Make anchor processing a bit more obvious
-rw-r--r--sdn.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/sdn.cpp b/sdn.cpp
index fc87eb5..734c78e 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -796,7 +796,7 @@ fun reload (const string &old_cwd) {
endgrent();
string anchor;
- if (!g.entries.empty ())
+ if (g.cwd == old_cwd && !g.entries.empty ())
anchor = g.entries[g.cursor].filename;
auto now = time (NULL); g.now = *localtime (&now);
@@ -814,7 +814,7 @@ fun reload (const string &old_cwd) {
sort (begin (g.entries), end (g.entries));
g.out_of_date = false;
- if (g.cwd == old_cwd && !anchor.empty ()) {
+ if (!anchor.empty ()) {
for (size_t i = 0; i < g.entries.size (); i++)
if (g.entries[i].filename == anchor)
g.cursor = i;