From af5938cb6c32099d80bd35a1030e0240c1723426 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 16 Jan 2012 15:08:55 +0000 Subject: [PATCH] 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 --- src/Text.cpp | 6 +++++- src/Text.h | 2 ++ src/insets/InsetIndex.cpp | 2 +- status.20x | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Text.cpp b/src/Text.cpp index 066d0f9cf9..c1d782f342 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -69,6 +69,7 @@ #include +#include #include 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::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) diff --git a/src/Text.h b/src/Text.h index 60b6130cc4..c4da020cce 100644 --- a/src/Text.h +++ b/src/Text.h @@ -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 diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index bec5a90e09..0bab8008bd 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -356,7 +356,7 @@ void InsetIndex::addToToc(DocIterator const & cpit) const DocIterator pit = cpit; pit.push_back(CursorSlice(const_cast(*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); diff --git a/status.20x b/status.20x index 713b8d26de..bc27d5e5c2 100644 --- a/status.20x +++ b/status.20x @@ -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