Fix bug #5435: DEPM is not executed when leaving an inset.

Now, it is fixed for char-forward and char-backward.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29585 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2009-05-09 16:56:49 +00:00
parent 74784942ed
commit ba37ec9813

View File

@ -607,6 +607,19 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
&& cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
// we will probably be moving out the inset, so we should execute
// the depm-mechanism, but only when the cursor has a place to
// go outside this inset, i.e. in a slice above.
if (cur.depth() > 1 && cur.pos() == cur.lastpos()
&& cur.pit() == cur.lastpit()) {
// The cursor hasn't changed yet. To give the
// DEPM the possibility of doing something we must
// provide it with two different cursors.
Cursor dummy = cur;
dummy.pos() = dummy.pit() = 0;
cur.bv().checkDepm(dummy, cur);
}
}
break;
@ -620,6 +633,19 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
&& cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
// we will probably be moving out the inset, so we should execute
// the depm-mechanism, but only when the cursor has a place to
// go outside this inset, i.e. in a slice above.
if (cur.depth() > 1 && cur.pos() == 0 && cur.pit() == 0) {
// The cursor hasn't changed yet. To give the
// DEPM the possibility of doing something we must
// provide it with two different cursors.
Cursor dummy = cur;
dummy.pos() = cur.lastpos();
dummy.pit() = cur.lastpit();
cur.bv().checkDepm(dummy, cur);
}
}
break;