commit e3a72156f9eb670006e1e7fb64172d586dfedf32
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed Aug 12 17:38:20 2020 +0200

    Fix too general application of \cprotect
---
 src/Paragraph.cpp |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 3a9b034..8edf2ea 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1042,10 +1042,15 @@ void Paragraph::Private::latexInset(BufferParams const 
& bparams,
        if (open_font && (!inset->inheritFont() || inset->allowMultiPar())) {
                bool closeLanguage = arabtex
                        || basefont.isRightToLeft() == 
running_font.isRightToLeft();
+               InsetText const * textinset = inset->asInsetText();
+               bool const cprotect = textinset
+                       ? textinset->hasCProtectContent(runparams.moving_arg)
+                         && !textinset->text().isMainText()
+                       : false;
                unsigned int count = running_font.latexWriteStartChanges(os, 
bparams,
                                                      runparams, basefont,
                                                      running_font, true,
-                                                     
owner_->needsCProtection(runparams.moving_arg));
+                                                     cprotect);
                column += count;
                // if any font properties were closed, update the running_font,
                // making sure, however, to leave the language as it was
@@ -2659,9 +2664,14 @@ void Paragraph::latex(BufferParams const & bparams,
                        }
                        otexstringstream ots;
                        if (!multipar_inset) {
+                               InsetText const * textinset = 
inInset().asInsetText();
+                               bool const cprotect = textinset
+                                       ? 
textinset->hasCProtectContent(runparams.moving_arg)
+                                         && !textinset->text().isMainText()
+                                       : false;
                                column += 
current_font.latexWriteStartChanges(ots, bparams,
                                                                              
runparams, basefont, last_font, false,
-                                                                             
needsCProtection(runparams.moving_arg));
+                                                                             
cprotect);
                        }
                        // Check again for display math in ulem commands as a
                        // font change may also occur just before a math inset.
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to