From: Abdelrazak Younes Date: Wed, 11 Jul 2007 13:20:19 +0000 (+0000) Subject: Fix bug 3719: TOC skip-to points out of sync with document X-Git-Tag: 1.6.10~9161 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f1a6378d720bb49d07c40aab34b4cc5adcb05c5f;p=features.git Fix bug 3719: TOC skip-to points out of sync with document http://bugzilla.lyx.org/show_bug.cgi?id=3719 The problem is that the full toc is not regenerated when creating standard (i.e unnembered) paragraph. As the TocBackEnd use ParIterator for in buffer jumps, this can get out of sync. The partial updateLabel() is my doing and comes before the TocBackend stuf. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19040 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/Text.cpp b/src/Text.cpp index cd4a7c2cb5..db8929e4c0 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -644,12 +644,7 @@ void Text::breakParagraph(Cursor & cur, bool keep_layout) break; // the character couldn't be deleted physically due to change tracking } - ParIterator current_it(cur); - ParIterator last_it(cur); - ++last_it; - ++last_it; - - updateLabels(cur.buffer(), current_it, last_it); + updateLabels(cur.buffer()); // A singlePar update is not enough in this case. cur.updateFlags(Update::Force); diff --git a/src/Text3.cpp b/src/Text3.cpp index 1b9618654a..eac2e0ba91 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -375,16 +375,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) recUndo(cur, pit, pit + 1); finishUndo(); std::swap(pars_[pit], pars_[pit + 1]); - - ParIterator begin(cur); - // begin.pos() (== cur.pos()) may point beyond the end of the - // paragraph referenced by begin. This would cause a crash - // in updateLabels() - begin.pos() = 0; - ++cur.pit(); - ParIterator end = boost::next(ParIterator(cur)); - updateLabels(cur.buffer(), begin, end); - + updateLabels(cur.buffer()); needsUpdate = true; break; } @@ -394,17 +385,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) recUndo(cur, pit - 1, pit); finishUndo(); std::swap(pars_[pit], pars_[pit - 1]); - - ParIterator end = ParIterator(cur); - // end.pos() (== cur.pos()) may point beyond the end of the - // paragraph referenced by end. This would cause a crash - // in boost::next() - end.pos() = 0; - end = boost::next(end); - --cur.pit(); - ParIterator begin(cur); - updateLabels(cur.buffer(), begin, end); - + updateLabels(cur.buffer()); needsUpdate = true; break; }