Compare commits
No commits in common. "231348597066a5c70a89c70410371d1481fb3ae6" and "706795c85c89b5998d7fe4b56f6676be4eb17a11" have entirely different histories.
2313485970
...
706795c85c
24
sdn.cpp
24
sdn.cpp
@ -416,7 +416,6 @@ enum { ALT = 1 << 24, SYM = 1 << 25 }; // Outside the range of Unicode
|
|||||||
XX(SEARCH) XX(RENAME) XX(RENAME_PREFILL) \
|
XX(SEARCH) XX(RENAME) XX(RENAME_PREFILL) \
|
||||||
XX(TOGGLE_FULL) XX(REVERSE_SORT) XX(SHOW_HIDDEN) XX(REDRAW) XX(RELOAD) \
|
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_ABORT) XX(INPUT_CONFIRM) XX(INPUT_B_DELETE) XX(INPUT_DELETE) \
|
||||||
XX(INPUT_B_KILL_LINE) XX(INPUT_KILL_LINE) XX(INPUT_QUOTED_INSERT) \
|
|
||||||
XX(INPUT_BACKWARD) XX(INPUT_FORWARD) XX(INPUT_BEGINNING) XX(INPUT_END)
|
XX(INPUT_BACKWARD) XX(INPUT_FORWARD) XX(INPUT_BEGINNING) XX(INPUT_END)
|
||||||
|
|
||||||
#define XX(name) ACTION_ ## name,
|
#define XX(name) ACTION_ ## name,
|
||||||
@ -455,9 +454,6 @@ static map<wint_t, action> g_input_actions {
|
|||||||
// Sometimes terminfo is wrong, we need to accept both of these
|
// Sometimes terminfo is wrong, we need to accept both of these
|
||||||
{L'\b', ACTION_INPUT_B_DELETE}, {CTRL ('?'), ACTION_INPUT_B_DELETE},
|
{L'\b', ACTION_INPUT_B_DELETE}, {CTRL ('?'), ACTION_INPUT_B_DELETE},
|
||||||
{KEY (BACKSPACE), ACTION_INPUT_B_DELETE}, {KEY (DC), ACTION_INPUT_DELETE},
|
{KEY (BACKSPACE), ACTION_INPUT_B_DELETE}, {KEY (DC), ACTION_INPUT_DELETE},
|
||||||
{CTRL ('D'), ACTION_INPUT_DELETE}, {CTRL ('U'), ACTION_INPUT_B_KILL_LINE},
|
|
||||||
{CTRL ('K'), ACTION_INPUT_KILL_LINE},
|
|
||||||
{CTRL ('V'), ACTION_INPUT_QUOTED_INSERT},
|
|
||||||
{CTRL ('B'), ACTION_INPUT_BACKWARD}, {KEY (LEFT), ACTION_INPUT_BACKWARD},
|
{CTRL ('B'), ACTION_INPUT_BACKWARD}, {KEY (LEFT), ACTION_INPUT_BACKWARD},
|
||||||
{CTRL ('F'), ACTION_INPUT_FORWARD}, {KEY (RIGHT), ACTION_INPUT_FORWARD},
|
{CTRL ('F'), ACTION_INPUT_FORWARD}, {KEY (RIGHT), ACTION_INPUT_FORWARD},
|
||||||
{CTRL ('A'), ACTION_INPUT_BEGINNING}, {KEY (HOME), ACTION_INPUT_BEGINNING},
|
{CTRL ('A'), ACTION_INPUT_BEGINNING}, {KEY (HOME), ACTION_INPUT_BEGINNING},
|
||||||
@ -533,7 +529,6 @@ static struct {
|
|||||||
const wchar_t *editor; ///< Prompt string for editing
|
const wchar_t *editor; ///< Prompt string for editing
|
||||||
wstring editor_line; ///< Current user input
|
wstring editor_line; ///< Current user input
|
||||||
int editor_cursor = 0; ///< Cursor position
|
int editor_cursor = 0; ///< Cursor position
|
||||||
bool editor_inserting; ///< Inserting a literal character
|
|
||||||
void (*editor_on_change) (); ///< Callback on editor change
|
void (*editor_on_change) (); ///< Callback on editor change
|
||||||
void (*editor_on_confirm) (); ///< Callback on editor confirmation
|
void (*editor_on_confirm) (); ///< Callback on editor confirmation
|
||||||
|
|
||||||
@ -1190,12 +1185,7 @@ fun move_towards_spacing (int diff) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun handle_editor (wint_t c) {
|
fun handle_editor (wint_t c) {
|
||||||
auto i = g_input_actions.find (g.editor_inserting ? WEOF : c);
|
auto i = g_input_actions.find (c);
|
||||||
if (g.editor_inserting) {
|
|
||||||
(void) halfdelay (1);
|
|
||||||
g.editor_inserting = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (i == g_input_actions.end () ? ACTION_NONE : i->second) {
|
switch (i == g_input_actions.end () ? ACTION_NONE : i->second) {
|
||||||
case ACTION_INPUT_CONFIRM:
|
case ACTION_INPUT_CONFIRM:
|
||||||
if (g.editor_on_confirm)
|
if (g.editor_on_confirm)
|
||||||
@ -1205,7 +1195,6 @@ fun handle_editor (wint_t c) {
|
|||||||
g.editor = 0;
|
g.editor = 0;
|
||||||
g.editor_line.clear ();
|
g.editor_line.clear ();
|
||||||
g.editor_cursor = 0;
|
g.editor_cursor = 0;
|
||||||
g.editor_inserting = false;
|
|
||||||
g.editor_on_change = nullptr;
|
g.editor_on_change = nullptr;
|
||||||
g.editor_on_confirm = nullptr;
|
g.editor_on_confirm = nullptr;
|
||||||
break;
|
break;
|
||||||
@ -1240,17 +1229,6 @@ fun handle_editor (wint_t c) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_INPUT_B_KILL_LINE:
|
|
||||||
g.editor_line.erase (0, g.editor_cursor);
|
|
||||||
g.editor_cursor = 0;
|
|
||||||
break;
|
|
||||||
case ACTION_INPUT_KILL_LINE:
|
|
||||||
g.editor_line.erase (g.editor_cursor);
|
|
||||||
break;
|
|
||||||
case ACTION_INPUT_QUOTED_INSERT:
|
|
||||||
(void) raw ();
|
|
||||||
g.editor_inserting = true;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (c & (ALT | SYM)) {
|
if (c & (ALT | SYM)) {
|
||||||
beep ();
|
beep ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user