mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug #7774. It should be fine to show the complete index entry
in the TOC, as these generally aren't that long. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40625 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9af32c1740
commit
12b16d1ae9
@ -68,6 +68,7 @@
|
||||
|
||||
#include <boost/next_prior.hpp>
|
||||
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@ -1970,7 +1971,10 @@ docstring Text::asString(pit_type beg, pit_type end, int options) const
|
||||
|
||||
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)
|
||||
|
@ -129,6 +129,8 @@ public:
|
||||
/// 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
|
||||
|
@ -356,7 +356,7 @@ void InsetIndex::addToToc(DocIterator const & cpit) const
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user