]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
Fix dialog handling of Insert Plain Text
[lyx.git] / src / Text.cpp
index 1b9ca70d04ad19f09cb671f28d00b39de9686feb..02224a6ddc1b1d5925f3a22402bfefdc93a4e2b9 100644 (file)
@@ -44,6 +44,7 @@
 #include "Paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
+#include "TextClass.h"
 #include "TextMetrics.h"
 #include "VSpace.h"
 #include "WordLangTuple.h"
@@ -57,7 +58,7 @@
 #include "insets/InsetHFill.h"
 #include "insets/InsetLine.h"
 #include "insets/InsetNewline.h"
-#include "insets/InsetPagebreak.h"
+#include "insets/InsetNewpage.h"
 #include "insets/InsetOptArg.h"
 #include "insets/InsetSpace.h"
 #include "insets/InsetSpecialChar.h"
@@ -85,8 +86,8 @@ namespace lyx {
 
 using support::bformat;
 using support::contains;
-using support::rsplit;
 using support::split;
+using support::subst;
 
 using cap::cutSelection;
 using cap::pasteParagraphList;
@@ -244,6 +245,8 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex,
        } else if (token == "\\lyxline") {
                par.insertInset(par.size(), new InsetLine, font, change);
        } else if (token == "\\newpage") {
+               par.insertInset(par.size(), new InsetNewpage, font, change);
+       } else if (token == "\\pagebreak") {
                par.insertInset(par.size(), new InsetPagebreak, font, change);
        } else if (token == "\\clearpage") {
                par.insertInset(par.size(), new InsetClearPage, font, change);
@@ -309,8 +312,7 @@ void readParagraph(Buffer const & buf, Paragraph & par, Lexer & lex,
                        break;
                }
 
-               LYXERR(Debug::PARSER) << "Handling paragraph token: `"
-                                     << token << '\'' << endl;
+               LYXERR(Debug::PARSER, "Handling paragraph token: `" << token << '\'');
                if (token == "\\begin_layout" || token == "\\end_document"
                    || token == "\\end_inset" || token == "\\begin_deeper"
                    || token == "\\end_deeper") {
@@ -1277,8 +1279,7 @@ docstring Text::getPossibleLabel(Cursor & cur) const
        docstring par_text = pars_[pit].asString(cur.buffer(), false);
        string piece;
        // the return string of math matrices might contain linebreaks
-       // FIXME: unicode
-       par_text = from_utf8(rsplit(to_utf8(par_text), piece, '\n'));
+       par_text = subst(par_text, '\n', '-');
        for (int i = 0; i < lyxrc.label_init_length; ++i) {
                if (par_text.empty())
                        break;