mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Avoid full metrics computation when entering/leaving inset
Annotate function LFUN_FINISHED_xxx to indicate that they do not require a full metrics computation. Remove an "optimization" that meant that when the cursor changed inset, a full metrics computation was requested. Part of bug #12297
This commit is contained in:
parent
5e8578837f
commit
73678dcde9
@ -1655,7 +1655,7 @@ void LyXAction::init()
|
||||
* \li Notion: See also #LFUN_FINISHED_FORWARD.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_FINISHED_BACKWARD, "", ReadOnly, Hidden },
|
||||
{ LFUN_FINISHED_BACKWARD, "", ReadOnly | NoUpdate, Hidden },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_FINISHED_FORWARD
|
||||
@ -1668,7 +1668,7 @@ void LyXAction::init()
|
||||
back into the surrounding text.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_FINISHED_FORWARD, "", ReadOnly, Hidden },
|
||||
{ LFUN_FINISHED_FORWARD, "", ReadOnly | NoUpdate, Hidden },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_FINISHED_LEFT
|
||||
@ -1676,7 +1676,7 @@ void LyXAction::init()
|
||||
* \li Notion: See also #LFUN_FINISHED_FORWARD.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_FINISHED_LEFT, "", ReadOnly, Hidden },
|
||||
{ LFUN_FINISHED_LEFT, "", ReadOnly | NoUpdate, Hidden },
|
||||
|
||||
|
||||
/*!
|
||||
@ -1685,7 +1685,7 @@ void LyXAction::init()
|
||||
* \li Notion: See also #LFUN_FINISHED_FORWARD
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_FINISHED_RIGHT, "", ReadOnly, Hidden },
|
||||
{ LFUN_FINISHED_RIGHT, "", ReadOnly | NoUpdate, Hidden },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_FLEX_INSERT
|
||||
|
33
src/Text.cpp
33
src/Text.cpp
@ -6393,23 +6393,24 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
cur.screenUpdateFlags(Update::SinglePar | Update::FitCursor);
|
||||
return;
|
||||
}
|
||||
if (!needsUpdate
|
||||
&& &oldTopSlice.inset() == &cur.inset()
|
||||
&& oldTopSlice.idx() == cur.idx()
|
||||
&& !oldSelection // oldSelection is a backup of cur.selection() at the beginning of the function.
|
||||
&& !cur.selection())
|
||||
// FIXME: it would be better if we could just do this
|
||||
//
|
||||
//if (cur.result().update() != Update::FitCursor)
|
||||
// cur.noScreenUpdate();
|
||||
//
|
||||
// But some LFUNs do not set Update::FitCursor when needed, so we
|
||||
// do it for all. This is not very harmfull as FitCursor will provoke
|
||||
// a full redraw only if needed but still, a proper review of all LFUN
|
||||
// should be done and this needsUpdate boolean can then be removed.
|
||||
cur.screenUpdateFlags(Update::FitCursor);
|
||||
else
|
||||
if (needsUpdate)
|
||||
cur.screenUpdateFlags(Update::Force | Update::FitCursor);
|
||||
else {
|
||||
// oldSelection is a backup of cur.selection() at the beginning of the function.
|
||||
if (!oldSelection && !cur.selection())
|
||||
// FIXME: it would be better if we could just do this
|
||||
//
|
||||
//if (cur.result().update() != Update::FitCursor)
|
||||
// cur.noScreenUpdate();
|
||||
//
|
||||
// But some LFUNs do not set Update::FitCursor when needed, so we
|
||||
// do it for all. This is not very harmfull as FitCursor will provoke
|
||||
// a full redraw only if needed but still, a proper review of all LFUN
|
||||
// should be done and this needsUpdate boolean can then be removed.
|
||||
cur.screenUpdateFlags(Update::FitCursor);
|
||||
else
|
||||
cur.screenUpdateFlags(Update::ForceDraw | Update::FitCursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user