From: Abdelrazak Younes Date: Sun, 3 Jan 2010 11:00:21 +0000 (+0000) Subject: Fix bug #6388 X-Git-Tag: 2.0.0~4601 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=930088a07dc5685657991441ae756faacfca6340;p=features.git Fix bug #6388 * Buffer can be retrieved from currently set buffer_. * detachMacroParameters() doesn't really need a Cursor. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32752 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index 40adc50411..0c41fb634e 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -415,6 +415,9 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc) || 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 @@ -473,10 +476,9 @@ void MathData::updateMacros(Cursor * cur, MacroContext const & mc) } -void MathData::detachMacroParameters(Cursor * cur, const size_type macroPos) +void MathData::detachMacroParameters(DocIterator * cur, const size_type macroPos) { MathMacro * macroInset = operator[](macroPos).nucleus()->asMacro(); - Buffer * buf = cur->buffer(); // detach all arguments vector detachedArgs; @@ -531,7 +533,7 @@ void MathData::detachMacroParameters(Cursor * cur, const size_type macroPos) for (size_t q = 0; q < arg.size(); ++q) { if (arg[q]->getChar() == ']') { // put brace - brace = new InsetMathBrace(buf); + brace = new InsetMathBrace(buffer_); break; } } @@ -592,11 +594,8 @@ void MathData::detachMacroParameters(Cursor * cur, const size_type macroPos) ++(*cur)[curMacroSlice - 1].pos(); } - if (cur) { - // FIXME: proper anchor handling, this removes the selection - cur->clearSelection(); + if (cur) cur->updateInsets(&cur->bottom().inset()); - } } diff --git a/src/mathed/MathData.h b/src/mathed/MathData.h index fa2dc9dfa6..d238696a57 100644 --- a/src/mathed/MathData.h +++ b/src/mathed/MathData.h @@ -179,7 +179,7 @@ private: bool find1(MathData const & ar, size_type pos) const; /// - void detachMacroParameters(Cursor * cur, const size_type macroPos); + void detachMacroParameters(DocIterator * dit, const size_type macroPos); /// void attachMacroParameters(Cursor * cur, const size_type macroPos, const size_type macroNumArgs, const int macroOptionals,