From 0fa599cf52dd7179ccc29b1d607d433bba2ebafd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 30 Jan 2006 16:34:30 +0000 Subject: [PATCH] fix crash when undoing DEPM in last paragraph (bug 2022). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10799 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 5 +++++ src/text2.C | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index e08d16113c..ce29a6ce91 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-01-30 Jürgen Spitzmüller + + * * text2.C (deleteEmptyParagraphMechanism): fix off-by-one error of the start + pit of the uno range (bug 2022). + 2006-01-28 Georg Baum * messages.C (get): Only warn once if setlocale fails (bug 2177) diff --git a/src/text2.C b/src/text2.C index 15a25fd3d6..286a31ccf1 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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()); -- 2.39.2