mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Do not require cprotect if we only have a cprotectible inset in the maintext.
This commit is contained in:
parent
8da025014d
commit
1af0832f75
@ -3475,7 +3475,7 @@ bool Paragraph::needsCProtection() const
|
||||
// now check whether we have insets that need cprotection
|
||||
pos_type size = d->text_.size();
|
||||
for (pos_type i = 0; i < size; ++i)
|
||||
if (isInset(i) && getInset(i)->needsCProtection())
|
||||
if (isInset(i) && getInset(i)->needsCProtection(maintext))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -595,7 +595,7 @@ public:
|
||||
virtual void rejectChanges() {}
|
||||
|
||||
///
|
||||
virtual bool needsCProtection() const { return false; }
|
||||
virtual bool needsCProtection(bool const) const { return false; }
|
||||
|
||||
///
|
||||
virtual ColorCode backgroundColor(PainterInfo const &) const;
|
||||
|
@ -1086,7 +1086,7 @@ InsetText::XHTMLOptions operator|(InsetText::XHTMLOptions a1, InsetText::XHTMLOp
|
||||
}
|
||||
|
||||
|
||||
bool InsetText::needsCProtection() const
|
||||
bool InsetText::needsCProtection(bool const maintext) const
|
||||
{
|
||||
// Nested cprotect content needs \cprotect
|
||||
// on each level
|
||||
@ -1098,7 +1098,7 @@ bool InsetText::needsCProtection() const
|
||||
|
||||
// Environments and "no latex" types (e.g., knitr chunks)
|
||||
// need cprotection regardless the content
|
||||
if (getLayout().latextype() != InsetLayout::COMMAND)
|
||||
if (!maintext && getLayout().latextype() != InsetLayout::COMMAND)
|
||||
return true;
|
||||
|
||||
// Commands need cprotection if they contain specific chars
|
||||
|
@ -224,7 +224,7 @@ public:
|
||||
bool confirmDeletion() const { return !text().empty(); }
|
||||
|
||||
///
|
||||
bool needsCProtection() const;
|
||||
bool needsCProtection(bool const maintext = false) const;
|
||||
///
|
||||
bool hasCProtectContent() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user