backport of revision 22979 (fix bug 4547)

Author: younes
	Date: Wed Feb 13 15:16:51 2008
	New Revision: 22979

	URL: http://www.lyx.org/trac/changeset/22979
	Log:
	Fix crash when deleting outlined insets while the outline panel is open.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@23001 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-02-14 10:39:39 +00:00
parent b2c55c9823
commit ecec859094

View File

@ -1230,11 +1230,14 @@ bool Text::erase(Cursor & cur)
// this is the code for a normal delete, not pasting
// any paragraphs
recordUndo(cur, Undo::DELETE);
if(!par.eraseChar(cur.pos(), cur.buffer().params().trackChanges)) {
bool const was_inset = cur.paragraph().isInset(cur.pos());
if(!par.eraseChar(cur.pos(), cur.buffer().params().trackChanges))
// the character has been logically deleted only => skip it
cur.forwardPosNoDescend();
}
checkBufferStructure(cur.buffer(), cur);
if (was_inset)
updateLabels(cur.buffer());
else
checkBufferStructure(cur.buffer(), cur);
needsUpdate = true;
} else {
if (cur.pit() == cur.lastpit())
@ -1343,8 +1346,12 @@ bool Text::backspace(Cursor & cur)
// without the dreaded mechanism. (JMarc)
setCursorIntern(cur, cur.pit(), cur.pos() - 1,
false, cur.boundary());
bool const was_inset = cur.paragraph().isInset(cur.pos());
cur.paragraph().eraseChar(cur.pos(), cur.buffer().params().trackChanges);
checkBufferStructure(cur.buffer(), cur);
if (was_inset)
updateLabels(cur.buffer());
else
checkBufferStructure(cur.buffer(), cur);
}
if (cur.pos() == cur.lastpos())