mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-15 01:41:43 +00:00
branch: Fix bug #5435: DEPM is not executed when leaving an inset.
see r29585 and r29248. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30514 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
25aa3d4022
commit
e1bdd1b4ad
@ -322,6 +322,15 @@ void Cursor::dispatch(FuncRequest const & cmd0)
|
|||||||
// object will be used again.
|
// object will be used again.
|
||||||
if (!disp_.dispatched()) {
|
if (!disp_.dispatched()) {
|
||||||
LYXERR(Debug::DEBUG, "RESTORING OLD CURSOR!");
|
LYXERR(Debug::DEBUG, "RESTORING OLD CURSOR!");
|
||||||
|
// We might have invalidated the cursor when removing an empty
|
||||||
|
// paragraph while the cursor could not be moved out the inset
|
||||||
|
// while we initially thought we could. This might happen when
|
||||||
|
// a multiline inset becomes an inline inset when the second
|
||||||
|
// paragraph is removed.
|
||||||
|
if (safe.pit() > safe.lastpit()) {
|
||||||
|
safe.pit() = safe.lastpit();
|
||||||
|
safe.pos() = safe.lastpos();
|
||||||
|
}
|
||||||
operator=(safe);
|
operator=(safe);
|
||||||
disp_.update(Update::None);
|
disp_.update(Update::None);
|
||||||
disp_.dispatched(false);
|
disp_.dispatched(false);
|
||||||
@ -1791,8 +1800,34 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded)
|
|||||||
else
|
else
|
||||||
row = pm.pos2row(pos());
|
row = pm.pos2row(pos());
|
||||||
|
|
||||||
if (atFirstOrLastRow(up))
|
if (atFirstOrLastRow(up)) {
|
||||||
|
// Is there a place for the cursor to go ? If yes, we
|
||||||
|
// can execute the DEPM, otherwise we should keep the
|
||||||
|
// paragraph to host the cursor.
|
||||||
|
Cursor dummy = *this;
|
||||||
|
bool valid_destination = false;
|
||||||
|
for(; dummy.depth(); dummy.pop())
|
||||||
|
if (!dummy.atFirstOrLastRow(up)) {
|
||||||
|
valid_destination = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// will a next dispatch follow and if there is a new
|
||||||
|
// dispatch will it move the cursor out ?
|
||||||
|
if (depth() > 1 && valid_destination) {
|
||||||
|
// The cursor hasn't changed yet. This happens when
|
||||||
|
// you e.g. move out of an inset. And to give the
|
||||||
|
// DEPM the possibility of doing something we must
|
||||||
|
// provide it with two different cursors. (Lgb, vfr)
|
||||||
|
dummy = *this;
|
||||||
|
dummy.pos() = dummy.pos() == 0 ? dummy.lastpos() : 0;
|
||||||
|
dummy.pit() = dummy.pit() == 0 ? dummy.lastpit() : 0;
|
||||||
|
|
||||||
|
updateNeeded |= bv().checkDepm(dummy, *this);
|
||||||
|
updateTextTargetOffset();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// with and without selection are handled differently
|
// with and without selection are handled differently
|
||||||
if (!selection()) {
|
if (!selection()) {
|
||||||
|
@ -569,6 +569,19 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
&& cur.boundary() == oldBoundary) {
|
&& cur.boundary() == oldBoundary) {
|
||||||
cur.undispatched();
|
cur.undispatched();
|
||||||
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
cmd = FuncRequest(LFUN_FINISHED_FORWARD);
|
||||||
|
|
||||||
|
// we will probably be moving out the inset, so we should execute
|
||||||
|
// the depm-mechanism, but only when the cursor has a place to
|
||||||
|
// go outside this inset, i.e. in a slice above.
|
||||||
|
if (cur.depth() > 1 && cur.pos() == cur.lastpos()
|
||||||
|
&& cur.pit() == cur.lastpit()) {
|
||||||
|
// The cursor hasn't changed yet. To give the
|
||||||
|
// DEPM the possibility of doing something we must
|
||||||
|
// provide it with two different cursors.
|
||||||
|
Cursor dummy = cur;
|
||||||
|
dummy.pos() = dummy.pit() = 0;
|
||||||
|
cur.bv().checkDepm(dummy, cur);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -582,6 +595,19 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
&& cur.boundary() == oldBoundary) {
|
&& cur.boundary() == oldBoundary) {
|
||||||
cur.undispatched();
|
cur.undispatched();
|
||||||
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
cmd = FuncRequest(LFUN_FINISHED_BACKWARD);
|
||||||
|
|
||||||
|
// we will probably be moving out the inset, so we should execute
|
||||||
|
// the depm-mechanism, but only when the cursor has a place to
|
||||||
|
// go outside this inset, i.e. in a slice above.
|
||||||
|
if (cur.depth() > 1 && cur.pos() == 0 && cur.pit() == 0) {
|
||||||
|
// The cursor hasn't changed yet. To give the
|
||||||
|
// DEPM the possibility of doing something we must
|
||||||
|
// provide it with two different cursors.
|
||||||
|
Cursor dummy = cur;
|
||||||
|
dummy.pos() = cur.lastpos();
|
||||||
|
dummy.pit() = cur.lastpit();
|
||||||
|
cur.bv().checkDepm(dummy, cur);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -211,6 +211,8 @@ What's new
|
|||||||
- Do not open files during startup that were closed in the previous
|
- Do not open files during startup that were closed in the previous
|
||||||
session by Close View or Close Window (bug 5458).
|
session by Close View or Close Window (bug 5458).
|
||||||
|
|
||||||
|
- Remove empty paragraphs and superfluous spaces when leaving an inset
|
||||||
|
(bug 5435).
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user