]> git.lyx.org Git - features.git/commitdiff
Bug fix: Adjustment for multiple reference to the same label. The solution is still...
authorAbdelrazak Younes <younes@lyx.org>
Wed, 27 Feb 2008 16:44:57 +0000 (16:44 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 27 Feb 2008 16:44:57 +0000 (16:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23285 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetRef.cpp

index ddbff5ebb5a362e5b7aece417a6ca17f286321f2..b9e7909b220b45b4cc00c1e55a468e7f6882130d 100644 (file)
@@ -163,12 +163,19 @@ void InsetRef::addToToc(Buffer const & buf,
        Toc::const_iterator it = toc.begin();
        Toc::const_iterator end = toc.end();
        for (; it != end; ++it) {
-               if (it->str() == label) {
-                       ++it;
-                       toc.insert(it, TocItem(cpit, 1, getScreenLabel(buf)));
+               if (it->str() == label)
                        break;
-               }
        }
+
+       if (it == end)
+               //FIXME: this is an orphan, is this really possible?
+               return;
+
+       docstring const reflabel = getScreenLabel(buf);
+       ++it;
+       while (it->str() == reflabel && it != end)
+               ++it;
+       toc.insert(it, TocItem(cpit, 1, reflabel));
 }