Correctly merge backspace actions

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1023 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-07-11 17:37:39 +00:00
parent c733a1fae4
commit 3c4aa8346b
+11 -4
View File
@@ -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;