Make removing characters invoke g.editor_on_change

This commit is contained in:
Přemysl Eric Janouch 2021-07-17 07:24:16 +02:00
parent 98612f5492
commit 2238db5a4e
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 4 additions and 3 deletions

View File

@ -1195,6 +1195,7 @@ fun handle_editor (wint_t c) {
g.editor_inserting = false; g.editor_inserting = false;
} }
auto original = g.editor_line;
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)
@ -1207,7 +1208,7 @@ fun handle_editor (wint_t c) {
g.editor_inserting = false; 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; return;
case ACTION_INPUT_BEGINNING: case ACTION_INPUT_BEGINNING:
g.editor_cursor = 0; g.editor_cursor = 0;
break; break;
@ -1256,10 +1257,10 @@ fun handle_editor (wint_t c) {
} else { } else {
g.editor_line.insert (g.editor_cursor, 1, c); g.editor_line.insert (g.editor_cursor, 1, c);
g.editor_cursor++; g.editor_cursor++;
if (g.editor_on_change)
g.editor_on_change ();
} }
} }
if (g.editor_on_change && g.editor_line != original)
g.editor_on_change ();
} }
fun handle (wint_t c) -> bool { fun handle (wint_t c) -> bool {