]> git.lyx.org Git - features.git/commitdiff
tex2lyx: put adjacent comment lines in one ERT inset (#4797)
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 28 Dec 2022 08:40:22 +0000 (09:40 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 28 Dec 2022 08:40:22 +0000 (09:40 +0100)
src/tex2lyx/text.cpp

index 6e58fba08ed6b68ea94d4ea4a196b0b072c0eb99..4648983794c91685b3d4c52fbb8cbcc3bff4dff7 100644 (file)
@@ -2701,9 +2701,14 @@ void parse_comment(Parser & p, ostream & os, Token const & t, Context & context,
                   bool skipNewlines = false)
 {
        LASSERT(t.cat() == catComment, return);
-       if (!t.cs().empty()) {
+       string comment = t.cs();
+       // Join multiple consecutive comment lines into one ERT inset
+       while (p.next_token().cat() == catComment)
+               comment += "\n%" + p.get_token().cs();
+
+       if (!comment.empty()) {
                context.check_layout(os);
-               output_comment(p, os, t.cs(), context);
+               output_comment(p, os, comment, context);
                if (p.next_token().cat() == catNewline) {
                        // A newline after a comment line starts a new
                        // paragraph