mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 14:07:01 -04:00
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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user