#include <boost/next_prior.hpp>
+#include <limits>
#include <sstream>
void Text::forToc(docstring & os, size_t maxlen, bool shorten) const
{
- LASSERT(maxlen >= 8, maxlen = 30);
+ if (maxlen == 0)
+ maxlen = std::numeric_limits<std::size_t>::max();
+ else
+ LASSERT(maxlen >= 8, maxlen = TOC_ENTRY_LENGTH);
for (size_t i = 0; i != pars_.size() && os.length() < maxlen; ++i)
pars_[i].forToc(os, maxlen);
if (shorten && os.length() >= maxlen)
/// of \param os. If \param shorten is true, then we will shorten
/// \param os to maxlen chars and replace the final three by "...,
/// if \param os is longer than maxlen chars.
+ /// if \param maxlen is passed as 0, then it is ignored. (In fact,
+ /// it is reset to the maximum value for size_t.)
void forToc(docstring & os, size_t maxlen, bool shorten = true) const;
/// insert a character at cursor position
DocIterator pit = cpit;
pit.push_back(CursorSlice(const_cast<InsetIndex &>(*this)));
docstring str;
- text().forToc(str, TOC_ENTRY_LENGTH);
+ text().forToc(str, 0);
buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, str));
// Proceed with the rest of the inset.
InsetCollapsable::addToToc(cpit);