void InsetText::clear()
{
ParagraphList & pars = paragraphs();
- LASSERT(!pars.empty(), /**/);
+ LBUFERR(!pars.empty());
// This is a gross hack...
Layout const & old_layout = pars.begin()->layout();
}
-void InsetText::addToToc(DocIterator const & cdit) const
+void InsetText::addToToc(DocIterator const & cdit, bool output_active) const
{
DocIterator dit = cdit;
dit.push_back(CursorSlice(const_cast<InsetText &>(*this)));
BufferParams const & bufparams = buffer_->params();
int const min_toclevel = bufparams.documentClass().min_toclevel();
+ // we really should have done this before we got here, but it
+ // can't hurt too much to do it again
+ bool const doing_output = output_active && producesOutput();
// For each paragraph, traverse its insets and let them add
// their toc items
Inset & inset = *it->inset;
dit.pos() = it->pos;
//lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl;
- inset.addToToc(dit);
+ inset.addToToc(dit, doing_output);
if (inset.lyxCode() == ARG_CODE)
arginset = inset.asInsetText();
}
if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel) {
// insert this into the table of contents
docstring tocstring;
+ int const length = doing_output ? INT_MAX : TOC_ENTRY_LENGTH;
if (arginset) {
tocstring = par.labelString();
if (!tocstring.empty())
tocstring += ' ';
- arginset->text().forToc(tocstring, TOC_ENTRY_LENGTH);
+ arginset->text().forToc(tocstring, length);
} else
- par.forToc(tocstring, TOC_ENTRY_LENGTH);
+ par.forToc(tocstring, length);
dit.pos() = 0;
toc.push_back(TocItem(dit, toclevel - min_toclevel,
- tocstring, tocstring));
+ tocstring, doing_output, tocstring));
}
// And now the list of changes.
- par.addChangesToToc(dit, buffer());
+ par.addChangesToToc(dit, buffer(), doing_output);
}
}
// find text inset in old cursor
Cursor insetCur = old;
int scriptSlice = insetCur.find(this);
- LASSERT(scriptSlice != -1, /**/);
+ // we can try to continue here. returning true means
+ // the cursor is "now" invalid. which it was.
+ LASSERT(scriptSlice != -1, return true);
insetCur.cutOff(scriptSlice);
- LASSERT(&insetCur.inset() == this, /**/);
+ LASSERT(&insetCur.inset() == this, return true);
// update the old paragraph's words
insetCur.paragraph().updateWords();
bool InsetText::completionSupported(Cursor const & cur) const
{
- //LASSERT(&cur.bv().cursor().inset() != this, return false);
+ //LASSERT(&cur.bv().cursor().inset() == this, return false);
return text_.completionSupported(cur);
}