]> git.lyx.org Git - features.git/commitdiff
Correctly handle deleted environments in ct
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 26 Dec 2019 14:24:48 +0000 (15:24 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:49 +0000 (15:48 +0200)
Fixes #10252

src/output_latex.cpp

index 7849db583908ff0639f6aca27b383dc98bf69309..8830eb024ad0e861e0ef776136eaaaf657bf82bc 100644 (file)
@@ -1629,6 +1629,22 @@ void latexParagraphs(Buffer const & buf,
                        continue;
                }
 
+               // Do not output empty environments if the whole paragraph has
+               // been deleted with ct and changes are not output.
+               if (pit < runparams.par_end) {
+                       ParagraphList::const_iterator nextpar = paragraphs.constIterator(pit + 1);
+                       Paragraph const & cpar = paragraphs.at(pit);
+                       if ((par->layout() != nextpar->layout()
+                            || par->params().depth() == nextpar->params().depth()
+                            || par->params().leftIndent() == nextpar->params().leftIndent())
+                           && !runparams.for_search && cpar.size() > 0
+                           && cpar.isDeleted(0, cpar.size()) && !bparams.output_changes) {
+                               if (!bparams.output_changes && !cpar.parEndChange().deleted())
+                                       os << '\n' << '\n';
+                               continue;
+                       }
+               }
+
                TeXEnvironmentData const data =
                        prepareEnvironment(buf, text, par, os, runparams);
                // pit can be changed in TeXEnvironment.