summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-07-17 07:24:16 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-07-17 07:24:16 +0200
commit2238db5a4ebc2928e5e0b18ad6dd18ab2e40b977 (patch)
treeab9ae793d8d1796368deff41645c621174af830a
parent98612f549202c491c9b97df54e77d413a8e35e8d (diff)
downloadsdn-2238db5a4ebc2928e5e0b18ad6dd18ab2e40b977.tar.gz
sdn-2238db5a4ebc2928e5e0b18ad6dd18ab2e40b977.tar.xz
sdn-2238db5a4ebc2928e5e0b18ad6dd18ab2e40b977.zip
Make removing characters invoke g.editor_on_change
-rw-r--r--sdn.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/sdn.cpp b/sdn.cpp
index 3565bcb..ff5e804 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -1195,6 +1195,7 @@ fun handle_editor (wint_t c) {
g.editor_inserting = false;
}
+ auto original = g.editor_line;
switch (i == g_input_actions.end () ? ACTION_NONE : i->second) {
case ACTION_INPUT_CONFIRM:
if (g.editor_on_confirm)
@@ -1207,7 +1208,7 @@ fun handle_editor (wint_t c) {
g.editor_inserting = false;
g.editor_on_change = nullptr;
g.editor_on_confirm = nullptr;
- break;
+ return;
case ACTION_INPUT_BEGINNING:
g.editor_cursor = 0;
break;
@@ -1256,10 +1257,10 @@ fun handle_editor (wint_t c) {
} else {
g.editor_line.insert (g.editor_cursor, 1, c);
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 {