mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 00:39:18 +00:00
Avoid some full metrics computations related to math previews
When entering/leaving a math hull inset, a Update::Force flag was set, in case the metrics of the inset would change because of a switch between normal and preview representation. When entering the inset, this code is now used only when the inset was in preview mode. In both cases, Update::Force is replaced with Update::SinglePar. This requites in Text::dispatch to honor Update::SinglePar when it has been set by some lfun, even when singleparupdate is false. Part of bug #12297.
This commit is contained in:
parent
f7218cec18
commit
5e8578837f
@ -6386,7 +6386,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
|
||||
// FIXME: the following code should go in favor of fine grained
|
||||
// update flag treatment.
|
||||
if (singleParUpdate) {
|
||||
if (singleParUpdate || cur.result().screenUpdate() & Update::SinglePar) {
|
||||
// Inserting characters does not change par height in general. So, try
|
||||
// to update _only_ this paragraph. BufferView will detect if a full
|
||||
// metrics update is needed anyway.
|
||||
|
@ -902,7 +902,7 @@ bool InsetMathHull::notifyCursorLeaves(Cursor const & old, Cursor & cur)
|
||||
{
|
||||
if (RenderPreview::previewMath()) {
|
||||
reloadPreview(old);
|
||||
cur.screenUpdateFlags(Update::Force);
|
||||
cur.screenUpdateFlags(Update::SinglePar);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -2273,14 +2273,17 @@ void InsetMathHull::handleFont2(Cursor & cur, docstring const & arg)
|
||||
|
||||
void InsetMathHull::edit(Cursor & cur, bool front, EntryDirection entry_from)
|
||||
{
|
||||
bool const has_preview = previewState(&cur.bv());
|
||||
cur.push(*this);
|
||||
bool enter_front = (entry_from == Inset::ENTRY_DIRECTION_LEFT ||
|
||||
(entry_from == Inset::ENTRY_DIRECTION_IGNORE && front));
|
||||
enter_front ? idxFirst(cur) : idxLast(cur);
|
||||
// The inset formula dimension is not necessarily the same as the
|
||||
// one of the instant preview image, so we have to indicate to the
|
||||
// BufferView that a metrics update is needed.
|
||||
cur.screenUpdateFlags(Update::Force);
|
||||
if (has_preview) {
|
||||
// The inset formula dimension is in general different from the
|
||||
// one of the instant preview image, so we have to indicate to the
|
||||
// BufferView that a metrics update is needed.
|
||||
cur.screenUpdateFlags(Update::SinglePar);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user