]> git.lyx.org Git - lyx.git/blobdiff - src/output_latex.cpp
Do not output deleted rows columns if show changes in output is false
[lyx.git] / src / output_latex.cpp
index 7849db583908ff0639f6aca27b383dc98bf69309..8a6ed8f4e5230501c7b5a3a0e1f99ea75f27c6bc 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);
@@ -802,7 +818,8 @@ void TeXOnePar(Buffer const & buf,
                        // Due to the moving argument, some fragile
                        // commands (labels, index entries)
                        // are output after this command (#2154)
-                       runparams.postpone_fragile_stuff = true;
+                       runparams.postpone_fragile_stuff =
+                               bparams.postpone_fragile_content;
                if (intitle_command)
                        os << '{';
 
@@ -916,7 +933,8 @@ void TeXOnePar(Buffer const & buf,
                        // Due to the moving argument, some fragile
                        // commands (labels, index entries)
                        // are output after this command (#2154)
-                       runparams.postpone_fragile_stuff = true;
+                       runparams.postpone_fragile_stuff =
+                               bparams.postpone_fragile_content;
                os << '{';
        }
 
@@ -1133,7 +1151,8 @@ void TeXOnePar(Buffer const & buf,
                        // Due to the moving argument, some fragile
                        // commands (labels, index entries)
                        // are output after this command (#2154)
-                       runparams.postpone_fragile_stuff = true;
+                       runparams.postpone_fragile_stuff =
+                               bparams.postpone_fragile_content;
        }
 
        Font const outerfont = text.outerFont(pit);
@@ -1338,6 +1357,14 @@ void TeXOnePar(Buffer const & buf,
        bool const last_was_separator =
                par.size() > 0 && par.isEnvSeparator(par.size() - 1);
 
+       // Signify added/deleted par break in output if show changes in output
+       if (nextpar && !os.afterParbreak() && !last_was_separator
+           && bparams.output_changes && par.parEndChange().changed()) {
+               Changes::latexMarkChange(os, bparams, Change(Change::UNCHANGED),
+                                        par.parEndChange(), runparams);
+               os << bparams.encoding().latexString(docstring(1, 0x00b6)).first << "}";
+       }
+
        if (pending_newline) {
                if (unskip_newline)
                        // prevent unwanted whitespace
@@ -1629,6 +1656,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 (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()) && !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.