From fe4869557735548397f63e31fef10d0d6205108e Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 5 Mar 2007 13:16:55 +0000 Subject: [PATCH] Fix bug 3303 from Bernhard Roider. Some explanation: The problem was that pit is a reference to cur.pit() and was set to lastpit() + 1 before calling recordUndo(cur, ...). thus an invalid cursor position was stored in the undo buffer. A side effect of the attached patch is that now the cursor keeps staying in the moved section header on undo (which is not the case in current trunk) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17410 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/toc.C | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/toc.C b/src/toc.C index 26d537e2d5..0a44162032 100644 --- a/src/toc.C +++ b/src/toc.C @@ -80,11 +80,10 @@ void outline(OutlineOp mode, LCursor & cur) break; pit_type const newpit = std::distance(bgn, dest); pit_type const len = std::distance(start, finish); - pit += len; - pit = std::min(pit, cur.lastpit()); - recordUndo(cur, Undo::ATOMIC, newpit, pit); + pit_type const deletepit = pit + len; + recordUndo(cur, Undo::ATOMIC, newpit, deletepit - 1); pars.insert(dest, start, finish); - start = boost::next(bgn, pit); + start = boost::next(bgn, deletepit); pit = newpit; pars.erase(start, finish); break; -- 2.39.2