]> git.lyx.org Git - lyx.git/commitdiff
Fix display of section headings, etc, that include math in the TOC
authorRichard Heck <rgheck@comcast.net>
Tue, 25 Oct 2011 18:43:51 +0000 (18:43 +0000)
committerRichard Heck <rgheck@comcast.net>
Tue, 25 Oct 2011 18:43:51 +0000 (18:43 +0000)
and menus. The newline we were writing previously caused all kinds
of problems. Writing a whole array in some cases would also cause
problems. So we do less.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39971 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/InsetMathHull.cpp

index bfa12b0f11249c5675291c0b53bfc5420a1ceb60..18dd602ae930895210b70822544650b64cf62f41 100644 (file)
@@ -1894,7 +1894,7 @@ bool InsetMathHull::readQuiet(Lexer & lex)
 }
 
 
-int InsetMathHull::plaintext(odocstream & os, OutputParams const &) const
+int InsetMathHull::plaintext(odocstream & os, OutputParams const & op) const
 {
        // disables ASCII-art for export of equations. See #2275.
        if (0 && display()) {
@@ -1920,6 +1920,10 @@ int InsetMathHull::plaintext(odocstream & os, OutputParams const &) const
                for (row_type r = 0; r < nrows(); ++r) {
                        for (col_type c = 0; c < ncols(); ++c)
                                wi << (c == 0 ? "" : "\t") << cell(index(r, c));
+                       // if it's for the TOC, we write just the first line
+                       // and do not include the newline.
+                       if (op.for_toc)
+                               break;
                        wi << "\n";
                }
        }
@@ -2241,7 +2245,9 @@ void InsetMathHull::toString(odocstream & os) const
 void InsetMathHull::forToc(docstring & os, size_t) const
 {
        odocstringstream ods;
-       plaintext(ods, OutputParams(0));
+       OutputParams op(0);
+       op.for_toc = true;
+       plaintext(ods, op);
        os += ods.str();
 }