* avoid redraw if possible (OK by Abdel and Dov)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18580 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2007-05-30 19:38:22 +00:00
parent 0e0e15759a
commit 6569cfc81e
3 changed files with 22 additions and 20 deletions

View File

@ -1168,7 +1168,7 @@ bool Cursor::upDownInMath(bool up)
}
bool Cursor::upDownInText(bool up)
bool Cursor::upDownInText(bool up, bool & updateNeeded)
{
BOOST_ASSERT(text());
@ -1248,12 +1248,11 @@ bool Cursor::upDownInText(bool up)
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;
@ -1274,7 +1273,7 @@ bool Cursor::upDownInText(bool up)
}
}
bv().checkDepm(*this, old);
updateNeeded |= bv().checkDepm(*this, old);
}
updateTextTargetOffset();

View File

@ -256,12 +256,17 @@ public:
/// 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();

View File

@ -467,30 +467,28 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
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: