mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Fix up 5577e877
: remove logic error
Commit 5577e877
introduces forceUpdateBuffer() to delay actual
updatBuffer() calls to a central place.
In Cursor::upDownInText, the updateNeeded flag (which triggers
Update::Force update flag) is set to true when Cursor::checkDepm
returns true. This is fine, except that checkDepm also leads to a
forceBufferUpdate() call.
The logic in the method was such that, when updateNeeded is already
true when entering, forceBufferUpdate() will be called even though
checkDepm did not request it.
Fixes a slight delay with selecting in MergedManual (the manual of
manuals).
This commit is contained in:
parent
f58957747a
commit
9f33db8f53
@ -2143,7 +2143,7 @@ bool Cursor::mathBackward(bool word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
bool Cursor::upDownInText(bool up)
|
||||||
{
|
{
|
||||||
LASSERT(text(), return false);
|
LASSERT(text(), return false);
|
||||||
|
|
||||||
@ -2153,6 +2153,9 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
|||||||
getPos(xo, yo);
|
getPos(xo, yo);
|
||||||
xo = beforeDispatchPosX_;
|
xo = beforeDispatchPosX_;
|
||||||
|
|
||||||
|
// Is a full repaint necessary?
|
||||||
|
bool updateNeeded = false;
|
||||||
|
|
||||||
// update the targetX - this is here before the "return false"
|
// update the targetX - this is here before the "return false"
|
||||||
// to set a new target which can be used by InsetTexts above
|
// to set a new target which can be used by InsetTexts above
|
||||||
// if we cannot move up/down inside this inset anymore
|
// if we cannot move up/down inside this inset anymore
|
||||||
@ -2221,12 +2224,13 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
|||||||
dummy.pos() = dummy.pos() == 0 ? dummy.lastpos() : 0;
|
dummy.pos() = dummy.pos() == 0 ? dummy.lastpos() : 0;
|
||||||
dummy.pit() = dummy.pit() == 0 ? dummy.lastpit() : 0;
|
dummy.pit() = dummy.pit() == 0 ? dummy.lastpit() : 0;
|
||||||
|
|
||||||
updateNeeded |= bv().checkDepm(dummy, *this);
|
if (bv().checkDepm(dummy, *this)) {
|
||||||
updateTextTargetOffset();
|
updateNeeded = true;
|
||||||
if (updateNeeded)
|
|
||||||
forceBufferUpdate();
|
forceBufferUpdate();
|
||||||
|
}
|
||||||
|
updateTextTargetOffset();
|
||||||
}
|
}
|
||||||
return false;
|
return updateNeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
// with and without selection are handled differently
|
// with and without selection are handled differently
|
||||||
@ -2252,6 +2256,7 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
|||||||
++dummy.pos();
|
++dummy.pos();
|
||||||
if (bv().checkDepm(dummy, old)) {
|
if (bv().checkDepm(dummy, old)) {
|
||||||
updateNeeded = true;
|
updateNeeded = true;
|
||||||
|
forceBufferUpdate();
|
||||||
// Make sure that cur gets back whatever happened to dummy (Lgb)
|
// Make sure that cur gets back whatever happened to dummy (Lgb)
|
||||||
operator=(dummy);
|
operator=(dummy);
|
||||||
}
|
}
|
||||||
@ -2292,13 +2297,14 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
|||||||
// When selection==false, this is done by TextMetrics::editXY
|
// When selection==false, this is done by TextMetrics::editXY
|
||||||
setCurrentFont();
|
setCurrentFont();
|
||||||
|
|
||||||
updateNeeded |= bv().checkDepm(*this, old);
|
if (bv().checkDepm(*this, old)) {
|
||||||
|
updateNeeded = true;
|
||||||
|
forceBufferUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateNeeded)
|
|
||||||
forceBufferUpdate();
|
|
||||||
updateTextTargetOffset();
|
updateTextTargetOffset();
|
||||||
return true;
|
return updateNeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -506,9 +506,8 @@ public:
|
|||||||
/// return true if fullscreen update is needed
|
/// return true if fullscreen update is needed
|
||||||
bool down();
|
bool down();
|
||||||
/// move up/down in a text inset, called for LFUN_UP/DOWN,
|
/// move up/down in a text inset, called for LFUN_UP/DOWN,
|
||||||
/// return true if successful, updateNeeded set to true if fullscreen
|
/// return true if fullscreen update is needed
|
||||||
/// update is needed, otherwise it's not touched
|
bool upDownInText(bool up);
|
||||||
bool upDownInText(bool up, bool & updateNeeded);
|
|
||||||
/// move up/down in math or any non text inset, call for LFUN_UP/DOWN
|
/// move up/down in math or any non text inset, call for LFUN_UP/DOWN
|
||||||
/// return true if successful
|
/// return true if successful
|
||||||
bool upDownInMath(bool up);
|
bool upDownInMath(bool up);
|
||||||
|
11
src/Text.cpp
11
src/Text.cpp
@ -4333,7 +4333,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
if (!atFirstOrLastRow) {
|
if (!atFirstOrLastRow) {
|
||||||
needsUpdate |= cur.selHandle(select);
|
needsUpdate |= cur.selHandle(select);
|
||||||
cur.upDownInText(up, needsUpdate);
|
needsUpdate |= cur.upDownInText(up);
|
||||||
needsUpdate |= cur.beforeDispatchCursor().inMathed();
|
needsUpdate |= cur.beforeDispatchCursor().inMathed();
|
||||||
} else {
|
} else {
|
||||||
pos_type newpos = up ? 0 : cur.lastpos();
|
pos_type newpos = up ? 0 : cur.lastpos();
|
||||||
@ -4341,10 +4341,11 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
needsUpdate |= cur.selHandle(select);
|
needsUpdate |= cur.selHandle(select);
|
||||||
// we do not reset the targetx of the cursor
|
// we do not reset the targetx of the cursor
|
||||||
cur.pos() = newpos;
|
cur.pos() = newpos;
|
||||||
needsUpdate |= bv->checkDepm(cur, bv->cursor());
|
if (bv->checkDepm(cur, bv->cursor())) {
|
||||||
cur.updateTextTargetOffset();
|
needsUpdate = true;
|
||||||
if (needsUpdate)
|
|
||||||
cur.forceBufferUpdate();
|
cur.forceBufferUpdate();
|
||||||
|
}
|
||||||
|
cur.updateTextTargetOffset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4352,7 +4353,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
// the selection right now, but wait for the next dispatch.
|
// the selection right now, but wait for the next dispatch.
|
||||||
if (select)
|
if (select)
|
||||||
needsUpdate |= cur.selHandle(select);
|
needsUpdate |= cur.selHandle(select);
|
||||||
cur.upDownInText(up, needsUpdate);
|
needsUpdate |= cur.upDownInText(up);
|
||||||
cur.undispatched();
|
cur.undispatched();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user