aboutsummaryrefslogtreecommitdiff
path: root/sdn.cpp
diff options
context:
space:
mode:
authorPřemysl Janouch <p@janouch.name>2018-11-02 15:09:27 +0100
committerPřemysl Janouch <p@janouch.name>2018-11-02 15:09:27 +0100
commitd6846e63276365ae554671621532a4f63a86cbf4 (patch)
tree9f3a95058e75958ac2b54fee82576a0d07161737 /sdn.cpp
parent314ba114a1c1ce8b8a55459932adaf98e172d7d8 (diff)
downloadsdn-d6846e63276365ae554671621532a4f63a86cbf4.tar.gz
sdn-d6846e63276365ae554671621532a4f63a86cbf4.tar.xz
sdn-d6846e63276365ae554671621532a4f63a86cbf4.zip
Add an action for chdir
Diffstat (limited to 'sdn.cpp')
-rw-r--r--sdn.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/sdn.cpp b/sdn.cpp
index cac0c7f..d5b56d3 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -370,7 +370,7 @@ enum { ALT = 1 << 24, SYM = 1 << 25 }; // Outside the range of Unicode
#define ACTIONS(XX) XX(NONE) XX(CHOOSE) XX(CHOOSE_FULL) XX(HELP) XX(QUIT) \
XX(UP) XX(DOWN) XX(TOP) XX(BOTTOM) XX(PAGE_PREVIOUS) XX(PAGE_NEXT) \
- XX(SCROLL_UP) XX(SCROLL_DOWN) XX(GO_START) XX(GO_HOME) \
+ XX(SCROLL_UP) XX(SCROLL_DOWN) XX(CHDIR) XX(GO_START) XX(GO_HOME) \
XX(SEARCH) XX(RENAME) XX(RENAME_PREFILL) \
XX(TOGGLE_FULL) XX(REDRAW) XX(RELOAD) \
XX(INPUT_ABORT) XX(INPUT_CONFIRM) XX(INPUT_B_DELETE)
@@ -394,7 +394,7 @@ static map<wint_t, action> g_normal_actions {
{'G', ACTION_BOTTOM}, {ALT | '>', ACTION_BOTTOM}, {KEY(END), ACTION_BOTTOM},
{KEY (PPAGE), ACTION_PAGE_PREVIOUS}, {KEY (NPAGE), ACTION_PAGE_NEXT},
{CTRL 'y', ACTION_SCROLL_UP}, {CTRL 'e', ACTION_SCROLL_DOWN},
- {'&', ACTION_GO_START}, {'~', ACTION_GO_HOME},
+ {'c', ACTION_CHDIR}, {'&', ACTION_GO_START}, {'~', ACTION_GO_HOME},
{'/', ACTION_SEARCH}, {'s', ACTION_SEARCH},
{ALT | 'e', ACTION_RENAME_PREFILL}, {'e', ACTION_RENAME},
{'t', ACTION_TOGGLE_FULL}, {ALT | 't', ACTION_TOGGLE_FULL},
@@ -813,8 +813,7 @@ fun is_ancestor_dir (const string &ancestor, const string &of) -> bool {
}
fun pop_levels () {
- string anchor;
- auto i = g.levels.rbegin ();
+ string anchor; auto i = g.levels.rbegin ();
while (i != g.levels.rend () && !is_ancestor_dir (i->path, g.cwd)) {
if (i->path == g.cwd) {
g.offset = i->offset;
@@ -936,6 +935,12 @@ fun handle (wint_t c) -> bool {
g.offset--;
break;
+ case ACTION_CHDIR:
+ g.editor = L"chdir";
+ g.editor_on_confirm = [] {
+ change_dir (to_mb (g.editor_line));
+ };
+ break;
case ACTION_GO_START:
change_dir (g.start_dir);
break;