]> git.lyx.org Git - features.git/commitdiff
Fix http://bugzilla.lyx.org/show_bug.cgi?id=5392
authorAbdelrazak Younes <younes@lyx.org>
Wed, 29 Oct 2008 09:24:54 +0000 (09:24 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 29 Oct 2008 09:24:54 +0000 (09:24 +0000)
The problem is that, for an unknown reason, an InsetMathHull is used *inside* an InsetMathHull. This is the reason why we have two levels of instant preview. I don't know if that was intended.

When moving the cursor, only the doDispatch() of the enclosing InsetMathHull is
called, not the inner one; so we don't have a chance to detect that the inner InsetMathHull should leave its preview mode.

The new leavePreview() method ensures that the screen will be redrawn if needed with cursor movement.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27186 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathHull.cpp
src/mathed/InsetMathHull.h

index cc4672587d2d903dd3b337c32fc02c955eb144fa..c6d64e81f932f644dd0a07dee6ed190d08b0e041 100644 (file)
@@ -277,10 +277,22 @@ InsetMath::mode_type InsetMathHull::currentMode() const
 }
 
 
+void InsetMathHull::leavePreview(Cursor & cur) const
+{
+       if (!use_preview_)
+               return;
+       use_preview_ = false;
+       Update::flags flags = cur.result().update();
+       if (flags & Update::FitCursor)
+               cur.updateFlags(flags | Update::Force);
+}
+
+
 bool InsetMathHull::idxFirst(Cursor & cur) const
 {
        cur.idx() = 0;
        cur.pos() = 0;
+       leavePreview(cur);
        return true;
 }
 
@@ -289,6 +301,7 @@ bool InsetMathHull::idxLast(Cursor & cur) const
 {
        cur.idx() = nargs() - 1;
        cur.pos() = cur.lastpos();
+       leavePreview(cur);
        return true;
 }
 
index ce1e9e51dcf5163a4369881b1e41707bf657987c..821e269c4b6b5b1af6193eab0a726eb4f884e235 100644 (file)
@@ -231,6 +231,8 @@ protected:
        void handleFont2(Cursor & cur, docstring const & arg);
        ///
        bool previewState(BufferView * bv) const;
+       ///
+       void leavePreview(Cursor & cur) const;
 };