commit 7868929aacde4d9d015a7430a676276f9cbd1b2d
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Wed Dec 28 09:40:22 2022 +0100

    tex2lyx: put adjacent comment lines in one ERT inset (#4797)
---
 src/tex2lyx/text.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp
index 6e58fba..4648983 100644
--- a/src/tex2lyx/text.cpp
+++ b/src/tex2lyx/text.cpp
@@ -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
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to