From ba37ec98135f0182dd054c3e36c5d94944908d1e Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sat, 9 May 2009 16:56:49 +0000 Subject: [PATCH] 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 --- src/Text3.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/Text3.cpp b/src/Text3.cpp index c7fadab79d..08d15959e2 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -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; -- 2.39.2