]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
fix bug with relative paths in insetgraphics
[lyx.git] / src / text2.C
index 7ce0ae4a61268220ef34512c2d997be4a2c45fb9..bab91e69280dadb45ba976238749aead0761c195 100644 (file)
@@ -1647,13 +1647,12 @@ void LyXText::insertInset(BufferView * bview, Inset * inset)
 {
        if (!cursor.par()->insetAllowed(inset->lyxCode()))
                return;
-       // I don't know if this is necessary here (Jug 20020102)
-       setUndo(bview, Undo::INSERT, cursor.par(), cursor.par()->next());
+       setUndo(bview, Undo::FINISH, cursor.par(), cursor.par()->next());
+       freezeUndo();
        cursor.par()->insertInset(cursor.pos(), inset);
        // Just to rebreak and refresh correctly.
        // The character will not be inserted a second time
        insertChar(bview, Paragraph::META_INSET);
-#if 1
        // If we enter a highly editable inset the cursor should be to before
        // the inset. This couldn't happen before as Undo was not handled inside
        // inset now after the Undo LyX tries to call inset->Edit(...) again
@@ -1662,7 +1661,7 @@ void LyXText::insertInset(BufferView * bview, Inset * inset)
        if (isHighlyEditableInset(inset)) {
                cursorLeft(bview, true);
        }
-#endif
+       unFreezeUndo();
 }
 
 
@@ -2070,7 +2069,8 @@ void LyXText::setCursor(BufferView * bview, LyXCursor & cur, Paragraph * par,
        // the end of the previous row
        cur.iy(y + row->baseline());
        Inset * ins;
-       if (pos && par->getChar(pos) == Paragraph::META_INSET &&
+       if (row->previous() && pos &&
+               par->getChar(pos) == Paragraph::META_INSET &&
                (ins=par->getInset(pos)) && (ins->needFullRow() || ins->display()))
        {
                row = row->previous();