Commit 3b846eeb authored by twanvl's avatar twanvl

Correctly merge backspace actions

parent 3e35d483
...@@ -102,10 +102,17 @@ void TextValueAction::perform(bool to_undo) { ...@@ -102,10 +102,17 @@ void TextValueAction::perform(bool to_undo) {
bool TextValueAction::merge(const Action& action) { bool TextValueAction::merge(const Action& action) {
TYPE_CASE(action, TextValueAction) { TYPE_CASE(action, TextValueAction) {
if (&action.value() == &value() && action.name == name && action.selection_start == selection_end) { if (&action.value() == &value() && action.name == name) {
// adjacent edits, keep old value of this, it is older if (action.selection_start == selection_end) {
selection_end = action.selection_end; // adjacent edits, keep old value of this, it is older
return true; selection_end = action.selection_end;
return true;
} else if (action.new_selection_end == selection_start && name == _ACTION_("backspace")) {
// adjacent backspaces
selection_start = action.selection_start;
selection_end = action.selection_end;
return true;
}
} }
} }
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment