Fix crash when deleting outlined insets while the outline panel is open.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22979 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-13 14:16:51 +00:00
parent c65107ab21
commit cae858efc6

View File

@ -928,11 +928,15 @@ bool Text::erase(Cursor & cur)
// this is the code for a normal delete, not pasting
// any paragraphs
cur.recordUndo(DELETE_UNDO);
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.top().forwardPos();
}
cur.checkBufferStructure();
if (was_inset)
updateLabels(cur.buffer());
else
cur.checkBufferStructure();
needsUpdate = true;
} else {
if (cur.pit() == cur.lastpit())
@ -1043,8 +1047,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);
cur.checkBufferStructure();
if (was_inset)
updateLabels(cur.buffer());
else
cur.checkBufferStructure();
}
if (cur.pos() == cur.lastpos())