]> git.lyx.org Git - lyx.git/blobdiff - src/text3.C
Alfredo's second patch
[lyx.git] / src / text3.C
index 1df3ba307dfaf02877a8a5546c8b9039d3d08e34..3aa80b5bbdf3dd98cea6f4ed2102a5ed3faceda2 100644 (file)
@@ -201,14 +201,15 @@ bool LyXText::gotoNextInset(vector<Inset::Code> const & codes,
 
 
 void LyXText::gotoInset(vector<Inset::Code> const & codes,
-                                 bool same_content)
+                       bool same_content)
 {
        bv()->hideCursor();
        bv()->beforeChange(this);
        update();
 
        string contents;
-       if (same_content && cursor.par()->isInset(cursor.pos())) {
+       if (same_content && cursor.pos() < cursor.par()->size()
+           && cursor.par()->isInset(cursor.pos())) {
                Inset const * inset = cursor.par()->getInset(cursor.pos());
                if (find(codes.begin(), codes.end(), inset->lyxCode())
                    != codes.end())
@@ -418,7 +419,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
 
                for (; tmp != end; ++tmp) {
                        if (tmp->params().startOfAppendix()) {
-                               setUndo(bv, Undo::EDIT, &*tmp, &*boost::next(tmp));
+                               setUndo(bv, Undo::EDIT, tmp, boost::next(tmp));
                                tmp->params().startOfAppendix(false);
                                int tmpy;
                                setHeightOfRow(getRow(tmp, 0, tmpy));
@@ -426,7 +427,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        }
                }
 
-               setUndo(bv, Undo::EDIT, &*pit, &*boost::next(pit));
+               setUndo(bv, Undo::EDIT, pit, boost::next(pit));
                pit->params().startOfAppendix(start);
 
                // we can set the refreshing parameters now
@@ -1403,9 +1404,7 @@ Inset::RESULT LyXText::dispatch(FuncRequest const & cmd)
                        UpdatableInset * inset = static_cast<UpdatableInset *>(inset_hit);
                        selection_possible = false;
                        bv->owner()->message(inset->editMessage());
-                       //inset->edit(bv, x, y, cmd.button());
                        // We just have to lock the inset before calling a PressEvent on it!
-                       // we don't need the edit() call here! (Jug20020329)
                        if (!bv->lockInset(inset))
                                lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
                        FuncRequest cmd1(bv, LFUN_MOUSE_PRESS, x, y, cmd.button());