]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetinclude.C
* BufferParams:
[lyx.git] / src / insets / insetinclude.C
index 53759778f8c6f7ca3d647515f2199936dd1ad382..c2d08f788b243757d002bc02d48bf45085d7ee96 100644 (file)
@@ -271,13 +271,13 @@ void InsetInclude::read(Buffer const &, LyXLex & lex)
 void InsetInclude::read(LyXLex & lex)
 {
        if (lex.isOK()) {
-               lex.next();
+               lex.eatLine();
                string const command = lex.getString();
                params_.scanCommand(command);
        }
        string token;
        while (lex.isOK()) {
-               lex.eatLine();
+               lex.next();
                token = lex.getString();
                if (token == "\\end_inset")
                        break;
@@ -369,7 +369,7 @@ bool loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params)
 
 
 int InsetInclude::latex(Buffer const & buffer, odocstream & os,
-                       OutputParams const & runparams) const
+                        OutputParams const & runparams) const
 {
        string incfile(to_utf8(params_["filename"]));
 
@@ -491,22 +491,26 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os,
 
 
 int InsetInclude::plaintext(Buffer const & buffer, odocstream & os,
-                       OutputParams const &) const
+                            OutputParams const &) const
 {
        if (isVerbatim(params_)) {
+               os << '[' << getScreenLabel(buffer) << '\n';
                // FIXME: We don't know the encoding of the file
-               docstring const str = from_utf8(
-                       getFileContents(includedFilename(buffer, params_)));
+               docstring const str =
+                    from_utf8(getFileContents(includedFilename(buffer, params_)));
                os << str;
-               // Return how many newlines we issued.
-               return int(lyx::count(str.begin(), str.end(), '\n'));
+               os << "\n]";
+               return PLAINTEXT_NEWLINE + 1; // one char on a separate line
+       } else {
+               docstring const str = '[' + getScreenLabel(buffer) + ']';
+               os << str;
+               return str.size();
        }
-       return 0;
 }
 
 
 int InsetInclude::docbook(Buffer const & buffer, odocstream & os,
-                         OutputParams const & runparams) const
+                          OutputParams const & runparams) const
 {
        string incfile = to_utf8(params_["filename"]);
 
@@ -735,7 +739,7 @@ bool preview_wanted(InsetCommandParams const & params, Buffer const & buffer)
 docstring const latex_string(InsetInclude const & inset, Buffer const & buffer)
 {
        odocstringstream os;
-       OutputParams runparams;
+       OutputParams runparams(0);
        runparams.flavor = OutputParams::LATEX;
        inset.latex(buffer, os, runparams);