]> git.lyx.org Git - lyx.git/commitdiff
Fix bug 3023 (Clicking into a math inset resets the position of the TOC dialog):
authorAbdelrazak Younes <younes@lyx.org>
Wed, 7 Feb 2007 22:24:17 +0000 (22:24 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 7 Feb 2007 22:24:17 +0000 (22:24 +0000)
http://bugzilla.lyx.org/show_bug.cgi?id=3023

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17102 a592a061-630c-0410-9148-cb99ea01b6c8

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