[LyX/master] Do not close language before PassThru insets

Juergen Spitzmueller spitz at lyx.org
Fri Aug 14 07:25:20 UTC 2020


commit 70eb8c37cb2f002991913ebe7a19cd50f4a9d922
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Aug 14 09:50:40 2020 +0200

    Do not close language before PassThru insets
---
 src/Paragraph.cpp |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index e066d2b..45cc80e 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1030,13 +1030,17 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 	if (open_font && (!inset->inheritFont() || inset->allowMultiPar())) {
 		// Some insets cannot be inside a font change command.
 		// However, even such insets *can* be placed in \L or \R
-		// or their equivalents (for RTL language switches), so we don't
-		// close the language in those cases.
-		// ArabTeX, though, cannot handle this special behavior, it seems.
-		bool arabtex = basefont.language()->lang() == "arabic_arabtex"
-			|| running_font.language()->lang() == "arabic_arabtex";
-		bool closeLanguage = arabtex
-			|| basefont.isRightToLeft() == running_font.isRightToLeft();
+		// or their equivalents (for RTL language switches),
+		// so we don't close the language in those cases
+		// (= differing isRightToLeft()).
+		// ArabTeX, though, doesn't seem to handle this special behavior.
+		bool const inRLSwitch = 
+				basefont.isRightToLeft() != running_font.isRightToLeft()
+				&& basefont.language()->lang() != "arabic_arabtex"
+				&& running_font.language()->lang() != "arabic_arabtex";
+		// Having said that, PassThru insets must be inside a font change command,
+		// as we do not re-open the font inside. So:
+		bool const closeLanguage = !inset->isPassThru() && !inRLSwitch;
 		bool lang_closed = false;
 		bool lang_switched_at_inset = false;
 		// Close language if needed


More information about the lyx-cvs mailing list