]> git.lyx.org Git - features.git/commitdiff
Fix bug #7774. It should be fine to show the complete index entry
authorRichard Heck <rgheck@comcast.net>
Mon, 16 Jan 2012 15:01:02 +0000 (15:01 +0000)
committerRichard Heck <rgheck@comcast.net>
Mon, 16 Jan 2012 15:01:02 +0000 (15:01 +0000)
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

src/Text.cpp
src/Text.h
src/insets/InsetIndex.cpp

index 5f79e38a99af5b089f4cef03ce4d109abd3c2fb4..328eb55f1d5f7009e7bf808055032211fe12648d 100644 (file)
@@ -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)
index 60b6130cc4f2ea067d156ad2ec736ef88bc4196c..c4da020cceb442e2e1fd8b2209a60ba6aa3948ae 100644 (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
index 51ba81be84ff9999b7238b6065ff0862241ac122..e6335953c2ce50472d16034ef22eda0f5643c34a 100644 (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);