}
-bool Cursor::upDownInText(bool up)
+bool Cursor::upDownInText(bool up, bool & updateNeeded)
{
BOOST_ASSERT(text());
Cursor dummy = *this;
if (dummy == old)
++dummy.pos();
-
- bool const changed = bv().checkDepm(dummy, old);
-
- // Make sure that cur gets back whatever happened to dummy(Lgb)
- if (changed)
+ if (bv().checkDepm(dummy, old)) {
+ updateNeeded = true;
+ // Make sure that cur gets back whatever happened to dummy(Lgb)
operator=(dummy);
+ }
} else {
// if there is a selection, we stay out of any inset, and just jump to the right position:
Cursor old = *this;
}
}
- bv().checkDepm(*this, old);
+ updateNeeded |= bv().checkDepm(*this, old);
}
updateTextTargetOffset();
/// return false for empty math insets
bool backspace();
/// move the cursor up by sending an internal LFUN_UP
+ /// return true if fullscreen update is needed
bool up();
- /// move the cursor up by sending an internal LFUN_DOWN
+ /// move the cursor up by sending an internal LFUN_DOWN,
+ /// return true if fullscreen update is needed
bool down();
- /// move up/down in a text inset, called for LFUN_UP/DOWN
- bool upDownInText(bool up);
+ /// move up/down in a text inset, called for LFUN_UP/DOWN,
+ /// return true if successful, updateNeeded set to true if fullscreen
+ /// update is needed, otherwise it's not touched
+ bool upDownInText(bool up, bool & updateNeeded);
/// move up/down in math or any non text inset, call for LFUN_UP/DOWN
+ /// return true if successful
bool upDownInMath(bool up);
///
void plainErase();
break;
case LFUN_UP:
- case LFUN_UP_SELECT:
+ case LFUN_UP_SELECT: {
//lyxerr << "handle LFUN_UP[SEL]:\n" << cur << endl;
needsUpdate |= cur.selHandle(cmd.action == LFUN_UP_SELECT);
- needsUpdate |= cur.upDownInText(true);
-
- if (!needsUpdate && oldTopSlice == cur.top()
- && cur.boundary() == oldBoundary)
+ bool const successful = cur.upDownInText(true, needsUpdate);
+ if (!successful)
cur.undispatched();
if (cur.selection())
saveSelection(cur);
break;
+ }
case LFUN_DOWN:
- case LFUN_DOWN_SELECT:
+ case LFUN_DOWN_SELECT: {
//lyxerr << "handle LFUN_DOWN[SEL]:\n" << cur << endl;
needsUpdate |= cur.selHandle(cmd.action == LFUN_DOWN_SELECT);
- needsUpdate |= cur.upDownInText(false);
-
- if (!needsUpdate && oldTopSlice == cur.top() &&
- cur.boundary() == oldBoundary)
+ bool const successful = cur.upDownInText(false, needsUpdate);
+ if (!successful)
cur.undispatched();
if (cur.selection())
saveSelection(cur);
break;
+ }
case LFUN_PARAGRAPH_UP:
case LFUN_PARAGRAPH_UP_SELECT: