diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-10-30 12:32:40 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-10-30 12:32:40 +0200 |
commit | 916f354c9b77881a50f3874e706d714ccbdc7dd0 (patch) | |
tree | 9572d75bd42cb25cafbc2b96c1f0778d8c9d6d64 /sdn.cpp | |
parent | 050f875c47d2f92e7b552ad88ad2daa816070d86 (diff) | |
download | sdn-916f354c9b77881a50f3874e706d714ccbdc7dd0.tar.gz sdn-916f354c9b77881a50f3874e706d714ccbdc7dd0.tar.xz sdn-916f354c9b77881a50f3874e706d714ccbdc7dd0.zip |
Move the cursor to just created directories
Diffstat (limited to 'sdn.cpp')
-rw-r--r-- | sdn.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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; |