Abdelrazak Younes wrote:
Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes
<[EMAIL PROTECTED]> writes:
Abdelrazak> Abdelrazak Younes wrote:
Ozgur Ugras BARAN wrote:
This small patch prevents LOF, LOT always selects the last entry.
LOT/LOF still does not follow the cursor, yet, but for this, we
need serious update in TocBackend.
Not that much work IMO. The problem is the way we search for the
toc item is very crude. Look at the comment in TocBackend::item():
// A good solution for Items inside insets would be to do: // //if
(std::distance(it->par_it_, current) <= 0) // return it; // // 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_text.pit()) return it;
This is not correct and will work only for top-level items. So if
someone could implement an <= operator for ParConstIterator, that
would solve our problem. Jean-Marc, Andre, your the experts in this
field, could you implement this:
bool operator<=(ParConstIterator const &, ParConstIterator const
&);
Abdelrazak> I've done it but I am not sure I got it right. JMarc?
Here is what I have. Not tested (not even sure it compiles). I use the
operator< for cursor slice, that looks both at pit and pos.
Your patch works fine in general but not in captions (for LOT and LOF).
This is because slices_[0] in the caption does not refer to the main
text but to the text within caption itself. I thought that slices_[0]
would always refer to the top-level Text. Am I missing something?
The problem lies probably in InsetCaption::addToToc():
ParConstIterator pit = par_const_iterator_begin(*this);
So par_const_iterator_begin() does not construct a fully legible
ParConstIterator. If you think about it, this is normal as you need the
Buffer information to do that properly...
I will commit the patch for TOC and will disable the update for LOT and
LOF (Ugras' patch).
Abdel.