]> git.lyx.org Git - features.git/commitdiff
Properly close and reopen lyxdeleted macro at font change
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 17 May 2020 12:54:59 +0000 (14:54 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 17 May 2020 12:54:59 +0000 (14:54 +0200)
Fixes #11867, amends [28da0f4360a/lyxgit]

src/Paragraph.cpp

index a6d61e6000797c2557667c0dd8559df0ca8f6816..bfae1fc67d049e06d815a1f08ba85ee8af67a116 100644 (file)
@@ -2563,6 +2563,10 @@ void Paragraph::latex(BufferParams const & bparams,
                Font const current_font = getFont(bparams, i, outerfont);
 
                Font const last_font = running_font;
+               bool const in_ct_deletion = (bparams.output_changes
+                                 && runningChange == change
+                                 && change.type == Change::DELETED
+                                 && !os.afterParbreak());
 
                // Do we need to close the previous font?
                if (open_font &&
@@ -2576,10 +2580,23 @@ void Paragraph::latex(BufferParams const & bparams,
                                alien_script.clear();
                        }
                        bool needPar = false;
+                       if (in_ct_deletion) {
+                               // We have to close and then reopen \lyxdeleted,
+                               // as strikeout needs to be on lowest level.
+                               os << '}';
+                               column += 1;
+                       }
                        column += running_font.latexWriteEndChanges(
                                    os, bparams, runparams, basefont,
                                    (i == body_pos-1) ? basefont : current_font,
                                    needPar);
+                       if (in_ct_deletion) {
+                               // We have to close and then reopen \lyxdeleted,
+                               // as strikeout needs to be on lowest level.
+                               OutputParams rp = runparams;
+                               column += Changes::latexMarkChange(os, bparams,
+                                       Change(Change::UNCHANGED), Change(Change::DELETED), rp);
+                       }
                        running_font = basefont;
                        open_font = false;
                }
@@ -2625,13 +2642,9 @@ void Paragraph::latex(BufferParams const & bparams,
 
                // Do we need to change font?
                if ((current_font != running_font ||
-                    current_font.language() != running_font.language()) &&
-                       i != body_pos - 1)
+                    current_font.language() != running_font.language())
+                   && i != body_pos - 1)
                {
-                       bool const in_ct_deletion = (bparams.output_changes
-                                                    && runningChange == change
-                                                    && change.type == Change::DELETED
-                                                    && !os.afterParbreak());
                        if (in_ct_deletion) {
                                // We have to close and then reopen \lyxdeleted,
                                // as strikeout needs to be on lowest level.