]> git.lyx.org Git - features.git/blobdiff - src/Cursor.cpp
Fix bug #2213 (part 5): GuiChanges lacks "Previous Change" button.
[features.git] / src / Cursor.cpp
index 4f915d653d76f0a177415de36e181f20a66fdce2..afa8a9b30ffaa5ad36db6cccd198fe5405b51645 100644 (file)
@@ -426,6 +426,12 @@ void Cursor::resetAnchor()
 }
 
 
+void Cursor::setCursorToAnchor()
+{
+       if (selection())
+               setCursor(anchor_);
+}
+
 
 bool Cursor::posBackward()
 {
@@ -1769,8 +1775,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 +1797,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;