]> git.lyx.org Git - features.git/commitdiff
Fix bug #5435: DEPM is not executed when leaving an inset.
authorVincent van Ravesteijn <vfr@lyx.org>
Sat, 9 May 2009 16:56:49 +0000 (16:56 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sat, 9 May 2009 16:56:49 +0000 (16:56 +0000)
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

index c7fadab79dd560a495a4cfef349c5790a3444b8c..08d15959e2d78f248a47a9f7afda67aaa4bfd39b 100644 (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;