Remove unwanted clearSelection()s in MathData::updateMacros(). These calls broke
text selection with keyboard and mouse, search-and-replace, restoring selection
after Undo, etc. in a document with math macros since 1.6.0. (Regression at
6aa54673 and 12314897)

I do not know the purpose of these calls, but the selection code has been worked
on since, and I cannot produce undesired behaviour after removing
them.
This commit is contained in:
Guillaume Munch 2015-08-29 01:51:38 +01:00
parent 21c30a09e1
commit 89342f2946

View File

@ -433,13 +433,8 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc,
if (oldDisplayMode == MathMacro::DISPLAY_NORMAL if (oldDisplayMode == MathMacro::DISPLAY_NORMAL
&& (macroInset->arity() != macroNumArgs && (macroInset->arity() != macroNumArgs
|| macroInset->optionals() != macroOptionals || macroInset->optionals() != macroOptionals
|| newDisplayMode == MathMacro::DISPLAY_UNFOLDED)) { || newDisplayMode == MathMacro::DISPLAY_UNFOLDED))
detachMacroParameters(cur, i); detachMacroParameters(cur, i);
// FIXME: proper anchor handling, this removes the selection
if (cur)
cur->clearSelection();
}
// the macro could have been copied while resizing this // the macro could have been copied while resizing this
macroInset = operator[](i).nucleus()->asMacro(); macroInset = operator[](i).nucleus()->asMacro();
@ -478,11 +473,8 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc,
attachMacroParameters(cur, i, macroNumArgs, macroOptionals, attachMacroParameters(cur, i, macroNumArgs, macroOptionals,
fromInitToNormalMode, interactive, appetite); fromInitToNormalMode, interactive, appetite);
if (cur) { if (cur)
// FIXME: proper anchor handling, this removes the selection
cur->updateInsets(&cur->bottom().inset()); cur->updateInsets(&cur->bottom().inset());
cur->clearSelection();
}
} }
// Give macro the chance to adapt to new situation. // Give macro the chance to adapt to new situation.