aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sdn.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/sdn.cpp b/sdn.cpp
index 67f928c..c467e75 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -828,8 +828,7 @@ fun at_cursor () -> const entry & {
return g.cursor >= int (g.entries.size ()) ? invalid : g.entries[g.cursor];
}
-fun resort (const string anchor = at_cursor ().filename) {
- sort (begin (g.entries), end (g.entries));
+fun focus (const string &anchor) {
if (!anchor.empty ()) {
for (size_t i = 0; i < g.entries.size (); i++)
if (g.entries[i].filename == anchor)
@@ -837,6 +836,11 @@ fun resort (const string anchor = at_cursor ().filename) {
}
}
+fun resort (const string anchor = at_cursor ().filename) {
+ sort (begin (g.entries), end (g.entries));
+ focus (anchor);
+}
+
fun reload (bool keep_anchor) {
g.unames.clear();
while (auto *ent = getpwent ())
@@ -1446,9 +1450,11 @@ fun handle (wint_t c) -> bool {
case ACTION_MKDIR:
g.editor = L"mkdir";
g.editor_on[ACTION_INPUT_CONFIRM] = [] {
- if (mkdir (to_mb (g.editor_line).c_str (), 0777))
+ auto mb = to_mb (g.editor_line);
+ if (mkdir (mb.c_str (), 0777))
show_message (strerror (errno));
reload (true);
+ focus (mb);
};
break;