Jean-Marc Lasgouttes wrote: > bool samePar(StableDocIterator const & i1, StableDocIterator const & i2) > { > StableDocIterator tmpi2 = i2; > tmpi2.back().pos() = i1.back().pos(); > return i1 == tmpi2; > } > > Would that work?
Almost. The attached works like a charme (I also tested the case of bug 1808). What do you think? Jürgen
Index: dociterator.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/dociterator.h,v retrieving revision 1.22 diff -p -u -r1.22 dociterator.h --- dociterator.h 3 Aug 2005 20:21:11 -0000 1.22 +++ dociterator.h 13 Oct 2005 12:35:54 -0000 @@ -274,6 +274,12 @@ public: DocIterator asDocIterator(InsetBase * start) const; /// size_t size() const { return data_.size(); } + /// type for cursor positions within a cell + typedef CursorSlice::pos_type pos_type; + /// return the position within the paragraph + pos_type pos() const { return data_.back().pos(); } + /// return the position within the paragraph + pos_type & pos() { return data_.back().pos(); } /// friend std::ostream & operator<<(std::ostream & os, StableDocIterator const & cur); Index: undo.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undo.C,v retrieving revision 1.67 diff -p -u -r1.67 undo.C --- undo.C 18 Jul 2005 11:00:14 -0000 1.67 +++ undo.C 13 Oct 2005 12:36:02 -0000 @@ -48,6 +48,14 @@ std::ostream & operator<<(std::ostream & } +bool samePar(StableDocIterator const & i1, StableDocIterator const & i2) +{ + StableDocIterator tmpi2 = i2; + tmpi2.pos() = i1.pos(); + return i1 == tmpi2; +} + + void doRecordUndo(Undo::undo_kind kind, DocIterator const & cell, pit_type first_pit, pit_type last_pit, @@ -77,7 +85,7 @@ void doRecordUndo(Undo::undo_kind kind, if (!undo_finished && kind != Undo::ATOMIC && !stack.empty() - && stack.top().cell == undo.cell + && samePar(stack.top().cell, undo.cell) && stack.top().kind == undo.kind && stack.top().from == undo.from && stack.top().end == undo.end)