Compare commits

...

2 Commits

Author SHA1 Message Date
Přemysl Eric Janouch e17c5e2083
Bind F6 to a rename prompt
Mostly just so that the F7 binding isn't completely alone.

Since Shift-F6 isn't something we can just bind to, use a prefill.
2021-07-17 14:47:50 +02:00
Přemysl Eric Janouch 9bd3739122
Bind F7 to an mkdir prompt
This might have needed more thought, but we'll see.
2021-07-17 14:41:57 +02:00
1 changed files with 12 additions and 2 deletions

14
sdn.cpp
View File

@ -407,7 +407,7 @@ enum { ALT = 1 << 24, SYM = 1 << 25 }; // Outside the range of Unicode
XX(UP) XX(DOWN) XX(TOP) XX(BOTTOM) XX(HIGH) XX(MIDDLE) XX(LOW) \
XX(PAGE_PREVIOUS) XX(PAGE_NEXT) XX(SCROLL_UP) XX(SCROLL_DOWN) \
XX(CHDIR) XX(PARENT) XX(GO_START) XX(GO_HOME) \
XX(SEARCH) XX(RENAME) XX(RENAME_PREFILL) \
XX(SEARCH) XX(RENAME) XX(RENAME_PREFILL) XX(MKDIR) \
XX(TOGGLE_FULL) XX(REVERSE_SORT) XX(SHOW_HIDDEN) XX(REDRAW) XX(RELOAD) \
XX(INPUT_ABORT) XX(INPUT_CONFIRM) XX(INPUT_B_DELETE) XX(INPUT_DELETE) \
XX(INPUT_B_KILL_LINE) XX(INPUT_KILL_LINE) XX(INPUT_QUOTED_INSERT) \
@ -441,6 +441,7 @@ static map<wint_t, action> g_normal_actions {
{'&', ACTION_GO_START}, {'~', ACTION_GO_HOME},
{'/', ACTION_SEARCH}, {'s', ACTION_SEARCH},
{ALT | 'e', ACTION_RENAME_PREFILL}, {'e', ACTION_RENAME},
{KEY (F (6)), ACTION_RENAME_PREFILL}, {KEY (F (7)), ACTION_MKDIR},
{'t', ACTION_TOGGLE_FULL}, {ALT | 't', ACTION_TOGGLE_FULL},
{'R', ACTION_REVERSE_SORT}, {ALT | '.', ACTION_SHOW_HIDDEN},
{CTRL ('L'), ACTION_REDRAW}, {'r', ACTION_RELOAD},
@ -1427,7 +1428,16 @@ fun handle (wint_t c) -> bool {
g.editor = L"rename";
g.editor_on_confirm = [] {
auto mb = to_mb (g.editor_line);
rename (at_cursor ().filename.c_str (), mb.c_str ());
if (rename (at_cursor ().filename.c_str (), mb.c_str ()))
show_message (strerror (errno));
reload (true);
};
break;
case ACTION_MKDIR:
g.editor = L"mkdir";
g.editor_on_confirm = [] {
if (mkdir (to_mb (g.editor_line).c_str (), 0777))
show_message (strerror (errno));
reload (true);
};
break;