From f86ab4de32daf3e583342879debbb212093cc9c2 Mon Sep 17 00:00:00 2001 From: Alfredo Braunstein Date: Tue, 5 Aug 2003 22:00:04 +0000 Subject: [PATCH] Fix the critical part of Bug 1255 and Bug 1256. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7511 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/text2.C | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6a67719661..dfe0a1c8e5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-08-05 Alfredo Braunstein + + * text2.C (DEPM): fix part of bug 1255 and 1256 + 2003-08-05 Jean-Marc Lasgouttes * BufferView_pimpl.C (workAreaDispatch): change to use diff --git a/src/text2.C b/src/text2.C index 8377ed5abc..2cd1c61f69 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1258,7 +1258,7 @@ void LyXText::cutSelection(bool doclear, bool realcut) } recordUndo(bv(), Undo::DELETE, selection.start.par(), - boost::prior(undoendpit)); + boost::prior(undoendpit)); endpit = selection.end.par(); @@ -1281,10 +1281,6 @@ void LyXText::cutSelection(bool doclear, bool realcut) selection.start.par()->stripLeadingSpaces(); redoParagraphs(selection.start.par(), boost::next(endpit)); -#warning FIXME latent bug - // endpit will be invalidated on redoParagraphs once ParagraphList - // becomes a std::list? There are maybe other places on which this - // can happend? (Ab) // cutSelection can invalidate the cursor so we need to set // it anew. (Lgb) // we prefer the end for when tracking changes @@ -2065,9 +2061,11 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) && old_cursor.pos() < old_cursor.par()->size() && old_cursor.par()->isLineSeparator(old_cursor.pos()) && old_cursor.par()->isLineSeparator(old_cursor.pos() - 1)) { - old_cursor.par()->erase(old_cursor.pos() - 1); + bool erased = old_cursor.par()->erase(old_cursor.pos() - 1); redoParagraph(old_cursor.par()); + if (!erased) + return false; #ifdef WITH_WARNINGS #warning This will not work anymore when we have multiple views of the same buffer // In this case, we will have to correct also the cursors held by -- 2.39.2