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
This commit is contained in:
Abdelrazak Younes 2007-03-05 13:16:55 +00:00
parent 1734c7c9ac
commit fe48695577

View File

@ -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;