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/branches/BRANCH_2_0_X@40627 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2012-01-16 15:08:55 +00:00
parent b4b4eac710
commit af5938cb6c
4 changed files with 10 additions and 2 deletions

View File

@ -69,6 +69,7 @@
#include <boost/next_prior.hpp>
#include <limits>
#include <sstream>
using namespace std;
@ -1942,7 +1943,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 > 10, 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)

View File

@ -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

View File

@ -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);

View File

@ -180,6 +180,8 @@ What's new
- Fix broken instant preview due to ghostscript on 64-bit Windows (bug 7938).
- Show entire index entry in outliner (bug 7774).
* DOCUMENTATION AND LOCALIZATION