]> git.lyx.org Git - lyx.git/blobdiff - src/TocBackend.C
* src/tabular.[Ch]: simplify plaintext methods, because there
[lyx.git] / src / TocBackend.C
index 1101b968d9a276ad99b8b7336fd608d6b5a47b67..48847483a05e807b8ac893e735cd8798827b3128 100644 (file)
@@ -208,6 +208,14 @@ TocIterator const TocBackend::item(
 
        --it;
 
+       ParConstIterator par_it_text = par_it;
+       if (par_it_text.inMathed())
+               // It would be better to do
+               //   par_it_text.backwardInset();
+               // but this method does not exist.
+               while (par_it_text.inMathed())
+                       par_it_text.backwardPos();
+
        for (; it != last; --it) {
                
                // A good solution for Items inside insets would be to do:
@@ -218,7 +226,7 @@ TocIterator const TocBackend::item(
                // But for an unknown reason, std::distance(current, it->par_it_) always
                // returns  a positive value and std::distance(it->par_it_, current) takes forever...
                // So for now, we do:
-               if (it->par_it_.pit() <= par_it.pit())
+               if (it->par_it_.pit() <= par_it_text.pit())
                        return it;
        }