]> git.lyx.org Git - features.git/commitdiff
Fix bug #6388
authorAbdelrazak Younes <younes@lyx.org>
Sun, 3 Jan 2010 11:00:21 +0000 (11:00 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 3 Jan 2010 11:00:21 +0000 (11:00 +0000)
* 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

src/mathed/MathData.cpp
src/mathed/MathData.h

index 40adc5041193a29192a1cf5a2a9ac3d88fa2ede5..0c41fb634eecd36011ddf50f846ed3ecd4021dfd 100644 (file)
@@ -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<MathData> 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());
-       }
 }
 
 
index fa2dc9dfa6dd294ae2524cce1ef68cf33d157b76..d238696a57a3734703bdcef7ff286ef59b20e6db 100644 (file)
@@ -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,