]> git.lyx.org Git - features.git/commitdiff
Fix return value of InsetInclude::plaintext
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 10 Sep 2006 09:28:00 +0000 (09:28 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 10 Sep 2006 09:28:00 +0000 (09:28 +0000)
* src/insets/insetinclude.C
(InsetInclude::plaintext): Add line counting code

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

src/insets/insetinclude.C

index 7d7cc36f95176eb2b30d8d04205343001d47fbb7..72fd3b0156d458a3d0a0577cf49900e7b9de4e6d 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "insets/render_preview.h"
 
+#include "support/lyxalgo.h"
 #include "support/filename.h"
 #include "support/filetools.h"
 #include "support/lstrings.h" // contains
@@ -472,8 +473,13 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
 int InsetInclude::plaintext(Buffer const & buffer, ostream & os,
                        OutputParams const &) const
 {
-       if (isVerbatim(params_))
-               os << getFileContents(includedFilename(buffer, params_));
+       if (isVerbatim(params_)) {
+               string const str =
+                       getFileContents(includedFilename(buffer, params_));
+               os << str;
+               // Return how many newlines we issued.
+               return int(lyx::count(str.begin(), str.end(), '\n'));
+       }
        return 0;
 }