]> git.lyx.org Git - features.git/commitdiff
Fix crash when deleting outlined insets while the outline panel is open.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 13 Feb 2008 14:16:51 +0000 (14:16 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 13 Feb 2008 14:16:51 +0000 (14:16 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22979 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text.cpp

index 6913f22d3a1eedfa0be001d896b8104621889a16..5a075e6f55c01a0173cf275ad68b2f97adcef59e 100644 (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())