From 89393031313d54b1f3483db6f72ce825bf8d1b2a Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 29 Oct 2008 09:24:54 +0000 Subject: [PATCH] Fix http://bugzilla.lyx.org/show_bug.cgi?id=5392 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 | 13 +++++++++++++ src/mathed/InsetMathHull.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index cc4672587d..c6d64e81f9 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -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; } diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index ce1e9e51dc..821e269c4b 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -231,6 +231,8 @@ protected: void handleFont2(Cursor & cur, docstring const & arg); /// bool previewState(BufferView * bv) const; + /// + void leavePreview(Cursor & cur) const; }; -- 2.39.5