Abdelrazak Younes wrote:
http://bugzilla.lyx.org/show_bug.cgi?id=3719

As explained in bugzilla, 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. I will replace all partial with full updatelabels() as soon as I commit my other pending patch.

Here is the full patch.

Abdel.
Index: Text.cpp
===================================================================
--- Text.cpp    (revision 19033)
+++ Text.cpp    (working copy)
@@ -644,13 +644,8 @@
                        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());
 
-       updateLabels(cur.buffer(), current_it, last_it);
-
        // A singlePar update is not enough in this case.
        cur.updateFlags(Update::Force);
 
Index: Text3.cpp
===================================================================
--- Text3.cpp   (revision 19033)
+++ Text3.cpp   (working copy)
@@ -375,16 +375,7 @@
                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 @@
                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;
        }

Reply via email to