Bug fix: Adjustment for multiple reference to the same label. The solution is still not optimal as any reference to a label after the reference will not get notice. This is because addToToc() is called iteratively through the document so the toc entry for the label is still not created... any idea to fix this is welcome.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23285 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-02-27 16:44:57 +00:00
parent c05db366bb
commit 9b9080c0e9

View File

@ -163,12 +163,19 @@ void InsetRef::addToToc(Buffer const & buf,
Toc::const_iterator it = toc.begin(); Toc::const_iterator it = toc.begin();
Toc::const_iterator end = toc.end(); Toc::const_iterator end = toc.end();
for (; it != end; ++it) { for (; it != end; ++it) {
if (it->str() == label) { if (it->str() == label)
++it;
toc.insert(it, TocItem(cpit, 1, getScreenLabel(buf)));
break; 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));
} }