]> git.lyx.org Git - lyx.git/commitdiff
Fix bugs #6078 and #9364
authorGuillaume Munch <gm@lyx.org>
Sat, 29 Aug 2015 00:51:38 +0000 (01:51 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 28 Sep 2015 03:22:06 +0000 (04:22 +0100)
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.

src/mathed/MathData.cpp

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