]> git.lyx.org Git - lyx.git/commitdiff
* cursor.C (popRight): place cursor at the right spot:
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 29 Dec 2006 14:17:48 +0000 (14:17 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 29 Dec 2006 14:17:48 +0000 (14:17 +0000)
notifyCursorLeaves may have killed the inset and put its contents
at lower level (bug 2908)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16430 a592a061-630c-0410-9148-cb99ea01b6c8

src/cursor.C

index 5bccc4d13b2a146428f7c7fc8a5b7504dd58045d..3146935b4795dd1b3fd22f80a82fe08e438e068f 100644 (file)
@@ -374,11 +374,12 @@ bool LCursor::popRight()
 {
        BOOST_ASSERT(!empty());
        //lyxerr << "Leaving inset to the right" << endl;
+       const pos_type lp = (depth() > 1) ? (*this)[depth() - 2].lastpos() : 0;
        inset().notifyCursorLeaves(*this);
        if (depth() == 1)
                return false;
        pop();
-       ++pos();
+       pos() += lastpos() - lp + 1;
        return true;
 }