On Wed, Mar 22, 2023 at 10:28 PM Udicoudco <udifog...@gmail.com> wrote: > > > 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.
I've forgot to test if we use polyglossia at the closing point of the inset. Attached a new patch > > 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..851fac846e 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) - // (lua)bidi - os << "\\LRE{"; + if (runparams.use_polyglossia) { + // (lua)bidi + 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,14 @@ void Paragraph::Private::latexInset(BufferParams const & bparams, throw; } - if (close) - os << '}'; + if (close) { + if (runparams.use_polyglossia + && (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