[LyX/master] Inset::forceLTR() only determines whether explicit switches are needed

Juergen Spitzmueller spitz at lyx.org
Mon Apr 10 07:16:43 UTC 2023


commit 2abde5d16254e8aac29e344442b09e6272000f13
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Apr 10 10:20:11 2023 +0200

    Inset::forceLTR() only determines whether explicit switches are needed
    
    (as opposed to InsetLayout::forceLTR()). So properly set this for ERT
    and remove downstream special casing
---
 src/Paragraph.cpp     |    5 +----
 src/insets/InsetERT.h |    3 +++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index c332ab0..3ec79d5 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1100,10 +1100,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 	    // babel with Xe/LuaTeX does not need a switch
 	    // and \L is not defined there.
 	    && (!runparams.isFullUnicode() || !runparams.use_babel)
-	    && running_font.isRightToLeft()
-	    // ERT is an exception, it should be output with no
-	    // decorations at all
-	    && inset->lyxCode() != ERT_CODE) {
+	    && running_font.isRightToLeft()) {
 		if (runparams.use_polyglossia) {
 			// (lua)bidi
 			// Displayed environments go in an LTR environment
diff --git a/src/insets/InsetERT.h b/src/insets/InsetERT.h
index 72220d0..8000c2c 100644
--- a/src/insets/InsetERT.h
+++ b/src/insets/InsetERT.h
@@ -36,6 +36,9 @@ public:
 	static CollapseStatus string2params(std::string const &);
 	///
 	static std::string params2string(CollapseStatus);
+	/// Do NOT force inset into LTR environment if surroundings are RTL
+	/// even though insetlayout has (and should have) forceltr true
+	bool forceLTR(OutputParams const &) const override { return false; }
 
 	std::string contextMenuName() const override
 		{ return "context-ert"; }


More information about the lyx-cvs mailing list