From 3c4aa8346b80d8fd885916055254692a873d3301 Mon Sep 17 00:00:00 2001 From: twanvl Date: Fri, 11 Jul 2008 17:37:39 +0000 Subject: [PATCH] Correctly merge backspace actions git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1023 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/data/action/value.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/data/action/value.cpp b/src/data/action/value.cpp index aa2ea199..b60471b0 100644 --- a/src/data/action/value.cpp +++ b/src/data/action/value.cpp @@ -102,10 +102,17 @@ void TextValueAction::perform(bool to_undo) { bool TextValueAction::merge(const Action& action) { TYPE_CASE(action, TextValueAction) { - if (&action.value() == &value() && action.name == name && action.selection_start == selection_end) { - // adjacent edits, keep old value of this, it is older - selection_end = action.selection_end; - return true; + if (&action.value() == &value() && action.name == name) { + if (action.selection_start == selection_end) { + // adjacent edits, keep old value of this, it is older + 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;