From e3a72156f9eb670006e1e7fb64172d586dfedf32 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 12 Aug 2020 17:38:20 +0200 Subject: [PATCH] Fix too general application of \cprotect --- src/Paragraph.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 3a9b03419e..8edf2ea91b 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.