]> git.lyx.org Git - features.git/commitdiff
Amend dc174db6c19
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 30 Dec 2019 12:25:49 +0000 (13:25 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:49 +0000 (15:48 +0200)
src/output_latex.cpp

index aca126ce2fa4e092a5e2a3e7b8ddb5662186ee44..4befb3cb6d09b4ef4c79ff72507e6d1cad88b7ca 100644 (file)
@@ -434,6 +434,22 @@ void TeXEnvironment(Buffer const & buf, Text const & text,
                        continue;
                }
 
+               // Do not output empty environments if the whole paragraph has
+               // been deleted with ct and changes are not output.
+               if (size_t(pit + 1) < paragraphs.size()) {
+                       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()) && !buf.params().output_changes) {
+                               if (!buf.params().output_changes && !cpar.parEndChange().deleted())
+                                       os << '\n' << '\n';
+                               continue;
+                       }
+               }
+
                // This is a new environment.
                TeXEnvironmentData const data =
                        prepareEnvironment(buf, text, par, os, runparams);