]> git.lyx.org Git - features.git/commitdiff
Fix bug 5435: DEPM doesn't function when leaving an inset
authorVincent van Ravesteijn <vfr@lyx.org>
Wed, 25 Mar 2009 21:21:00 +0000 (21:21 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Wed, 25 Mar 2009 21:21:00 +0000 (21:21 +0000)
http://bugzilla.lyx.org/show_bug.cgi?id=5435

The code for this was already present, but was never reached.

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

src/Cursor.cpp

index 4f915d653d76f0a177415de36e181f20a66fdce2..91402c3396211d227e3878ca1607560064fd05e1 100644 (file)
@@ -1769,8 +1769,17 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
        else
                row = pm.pos2row(pos());
                
-       if (atFirstOrLastRow(up))
+       if (atFirstOrLastRow(up)) {
+               Cursor dummy = *this;
+               // The cursor hasn't changed yet. This happens when
+               // you e.g. move out of an inset. And to give the 
+               // DEPM the possibility of doing something we must
+               // provide it with two different cursors. (Lgb, vfr)
+               dummy.pos() = dummy.pos() == 0 ? dummy.lastpos() : 0;
+               dummy.pit() = dummy.pit() == 0 ? dummy.lastpit() : 0;
+               updateNeeded |= bv().checkDepm(dummy, *this);
                return false;
+       }
 
        // with and without selection are handled differently
        if (!selection()) {
@@ -1782,19 +1791,6 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
                else
                        tm.editXY(*this, xo, yo + textRow().descent() + 1);
                clearSelection();
-               
-               // This happens when you move out of an inset.
-               // And to give the DEPM the possibility of doing
-               // something we must provide it with two different
-               // cursors. (Lgb)
-               Cursor dummy = *this;
-               if (dummy == old)
-                       ++dummy.pos();
-               if (bv().checkDepm(dummy, old)) {
-                       updateNeeded = true;
-                       // Make sure that cur gets back whatever happened to dummy(Lgb)
-                       operator=(dummy);
-               }
        } else {
                // if there is a selection, we stay out of any inset, and just jump to the right position:
                Cursor old = *this;