]> git.lyx.org Git - features.git/commitdiff
fix crash when undoing DEPM in last paragraph (bug 2022).
authorJürgen Spitzmüller <spitz@lyx.org>
Mon, 30 Jan 2006 16:34:30 +0000 (16:34 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Mon, 30 Jan 2006 16:34:30 +0000 (16:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10799 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text2.C

index e08d16113ca4339fc6becfba7774bbfc81e1a73a..ce29a6ce913e9e3b9743b0e660062aadc46ce483 100644 (file)
@@ -1,3 +1,8 @@
+2006-01-30  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
+
+       * * text2.C (deleteEmptyParagraphMechanism): fix off-by-one error of the start 
+       pit of the uno range (bug 2022).
+
 2006-01-28  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
 
        * messages.C (get): Only warn once if setlocale fails (bug 2177)
index 15a25fd3d6c223a65d76937cf0f8324761d01c0c..286a31ccf195936b17f11733562a3fb2fb2e08c5 100644 (file)
@@ -63,6 +63,7 @@ using lyx::pos_type;
 using std::endl;
 using std::ostringstream;
 using std::string;
+using std::max;
 using std::min;
 
 
@@ -1253,8 +1254,9 @@ bool LyXText::deleteEmptyParagraphMechanism(LCursor & cur, LCursor & old)
 
        if (oldpar.empty() || (oldpar.size() == 1 && oldpar.isLineSeparator(0))) {
                // Delete old par.
-               recordUndo(old, Undo::ATOMIC, 
-                          old.pit(), min(old.pit() + 1, old.lastpit()));
+               recordUndo(old, Undo::ATOMIC,
+                          max(old.pit() - 1, 0),
+                          min(old.pit() + 1, old.lastpit()));
                ParagraphList & plist = old.text()->paragraphs();
                plist.erase(plist.begin() + old.pit());