branch: Fix bug 5435: DEPM doesn't function when leaving an inset

http://bugzilla.lyx.org/show_bug.cgi?id=5435
The code for this was already present, but was never reached.

see:
http://www.lyx.org/trac/changeset/28910

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@29003 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-04-01 21:15:28 +00:00
parent 1450d8ac27
commit 0f290b2783

View File

@ -1786,8 +1786,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()) {
@ -1799,19 +1808,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;