On Wed, Mar 22, 2023 at 2:22 PM Scott Kostyshak <skost...@lyx.org> wrote:
>
> On Wed, Mar 22, 2023 at 01:13:27PM +0100, Jürgen Spitzmüller wrote:
> > Am Mittwoch, dem 22.03.2023 um 12:54 +0200 schrieb Udicoudco:
> > > I think in the case of where forceLTR insets will have multiple
> > > paragraphs, it is better to use
> > > \begin{RTL}...\end{RTL}, which basically only issues \par and sets
> > > the
> > > RTL related conditionals
> > > to be false.
> >
> > Thanks for the detailed explanation. Could you please file a ticket on
> > trac?
>

Sorry Jürgen, I did not notice I hit reply instead of reply all in my
last email.
I'm currently having difficulties with getting access to the bug tracker. If
I will manage to log in, I'll do that, but this is not likely to happen.

> If there's a patch, I'd be happy to run it through the ctests. If I recall 
> correctly, we have a good amount of tests for documents using Hebrew.

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.

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 << "\\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}";
+		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