]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
Fix a copy-paste error introduced in b754fb02
[lyx.git] / src / Text.cpp
index 88a1a4628020bbac09a6a79dd4f1f72cb5836505..328eb55f1d5f7009e7bf808055032211fe12648d 100644 (file)
@@ -46,7 +46,6 @@
 #include "ParIterator.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
-#include "VSpace.h"
 #include "WordLangTuple.h"
 #include "WordList.h"
 
 
 #include <boost/next_prior.hpp>
 
+#include <limits>
 #include <sstream>
 
+
+// TODO: replace if in Text::readParToken() with compile time switch
+#if 0
+
+#include "support/metahash.h"
+
+typedef boost::mpl::string<'\\end','_lay','out'> end_layout;
+typedef boost::mpl::string<'\\end','in','set'>   end_inset;
+
+void foo()
+{
+       std::string token = "\\end_layout";
+
+       switch (boost::hash_value(token)) {
+               case lyx::support::hash_string<end_layout>::value:
+                       return;
+               case lyx::support::hash_string<end_inset>::value:
+                       return;
+               default: ;
+       };
+
+}
+#endif
+
+
 using namespace std;
 using namespace lyx::support;
 
@@ -317,6 +342,7 @@ InsetText const & Text::inset() const
 }
 
 
+
 void Text::readParToken(Paragraph & par, Lexer & lex,
        string const & token, Font & font, Change & change, ErrorList & errorList)
 {
@@ -1945,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 > 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)