summaryrefslogtreecommitdiff
path: root/src/Fl_Text_Editor.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-11-05 22:10:24 +0100
committerMatthias Melcher <github@matthiasm.com>2023-11-05 22:19:03 +0100
commitf3b490134e511730d0d9f1c1ab78d57b4de11006 (patch)
tree8bdc883b81ace092b0ebc631c9255b573dd93d43 /src/Fl_Text_Editor.cxx
parent1f5472a7d37af7909c1daa37bb5aee7296df170a (diff)
Fixes text input widget undo propagation.
If not handled, undo propagates to other random widgets, and if none takes it, it is resent as a redo to all widgets.
Diffstat (limited to 'src/Fl_Text_Editor.cxx')
-rw-r--r--src/Fl_Text_Editor.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Fl_Text_Editor.cxx b/src/Fl_Text_Editor.cxx
index c548ef6be..29fb0d6e3 100644
--- a/src/Fl_Text_Editor.cxx
+++ b/src/Fl_Text_Editor.cxx
@@ -663,7 +663,13 @@ int Fl_Text_Editor::handle_key() {
Key_Func f;
f = bound_key_function(key, state, global_key_bindings);
if (!f) f = bound_key_function(key, state, key_bindings);
- if (f) return f(key, this);
+ if (f == kf_undo || f == kf_redo) {
+ // never propagate undo and redo up to another widget
+ if (!f(key, this)) fl_beep();
+ return 1;
+ } else if (f){
+ return f(key, this);
+ }
if (default_key_function_ && !state) return default_key_function_(c, this);
return 0;
}