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
This commit is contained in:
Abdelrazak Younes 2008-10-29 09:24:54 +00:00
parent 46b4a8428b
commit 8939303131
2 changed files with 15 additions and 0 deletions

View 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;
}

View File

@ -231,6 +231,8 @@ protected:
void handleFont2(Cursor & cur, docstring const & arg);
///
bool previewState(BufferView * bv) const;
///
void leavePreview(Cursor & cur) const;
};