> I attached a possible patch, it only fix the lstlisting case when
> polyglossia is used, since babel-hebrew does not have an equivalent
> to \begin{RTL}...\end{RTL} (or there is one?) and babel with luatex
> does not need this kind of wrappers.
I've added line breaks to the LaTeX code for
readability.

> Regards,
> Udi
> > --
> > lyx-devel mailing list
> > lyx-devel@lists.lyx.org
> > http://lists.lyx.org/mailman/listinfo/lyx-devel
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index c43421b376..93a0a7fee5 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1101,9 +1101,14 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 	    // ERT is an exception, it should be output with no
 	    // decorations at all
 	    && inset->lyxCode() != ERT_CODE) {
-		if (runparams.use_polyglossia)
+		if (runparams.use_polyglossia) {
 			// (lua)bidi
-			os << "\\LRE{";
+			if (inset->getLayout().name() == "Listings"
+			    || inset->getLayout().name() == "MintedListings")
+				os << "\n\\begin{RTL}";
+			else    	
+				os << "\\LRE{";
+		}
 		else if (running_font.language()->lang() == "farsi"
 			 || running_font.language()->lang() == "arabic_arabi")
 			os << "\\textLR{" << termcmd;
@@ -1187,8 +1192,13 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 		throw;
 	}
 
-	if (close)
-		os << '}';
+	if (close) {
+		if (inset->getLayout().name() == "Listings"
+			    || inset->getLayout().name() == "MintedListings")
+				os << "\\end{RTL}\n";
+		else
+			os << '}';
+	}
 
 	if (os.texrow().rows() > previous_row_count) {
 		os.texrow().start(owner_->id(), i + 1);
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to