]> git.lyx.org Git - lyx.git/blobdiff - src/Cursor.cpp
A couple comments and some very minor cleanup.
[lyx.git] / src / Cursor.cpp
index 3edf97065d34c4965be9b023a66cd07f503a36cb..eedc70725dcdbf2eee05d4ce0ab415acbf56cd24 100644 (file)
@@ -286,6 +286,8 @@ void Cursor::dispatch(FuncRequest const & cmd0)
        fixIfBroken();
        FuncRequest cmd = cmd0;
        Cursor safe = *this;
+
+       buffer()->undo().beginUndoGroup();
        
        // store some values to be used inside of the handlers
        beforeDispatchCursor_ = *this;
@@ -327,6 +329,7 @@ void Cursor::dispatch(FuncRequest const & cmd0)
                // are possible which would change it
                beforeDispatchCursor_ = safe.beforeDispatchCursor_;
        }
+       buffer()->undo().endUndoGroup();
 }
 
 
@@ -1420,7 +1423,8 @@ bool Cursor::macroModeClose()
        InsetMathUnknown * p = activeMacro();
        p->finalize();
        MathData selection;
-       asArray(p->selection(), selection);
+       // enclose selection in braces (bug #6270)
+       asArray('{' + p->selection() + '}', selection);
        docstring const s = p->name();
        --pos();
        cell().erase(pos());
@@ -2002,7 +2006,7 @@ Encoding const * Cursor::getEncoding() const
        CursorSlice const & sl = innerTextSlice();
        Text const & text = *sl.text();
        Font font = text.getPar(sl.pit()).getFont(
-               bv().buffer().params(), sl.pos(), outerFont(sl.pit(), text.paragraphs()));
+               bv().buffer().params(), sl.pos(), text.outerFont(sl.pit()));
        return font.language()->encoding();
 }
 
@@ -2059,7 +2063,7 @@ Font Cursor::getFont() const
        
        // get font at the position
        Font font = par.getFont(buffer()->params(), pos,
-               outerFont(sl.pit(), text.paragraphs()));
+               text.outerFont(sl.pit()));
 
        return font;
 }