From 5f3c0d5acacee76b1e04b219704f5a2017bbc7d8 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 7 Jan 2019 13:54:23 +0100 Subject: [PATCH] When using polyglossia (bidi), paragraph directions don't need to be swapped Bidi does that. Fixes: #11399 (cherry picked from commit 9d20bc4e989c57dc5498f231d890a0550375a753) --- src/Paragraph.cpp | 14 ++++++++++---- status.23x | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index a16437ddac..c8c42042c6 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2278,6 +2278,9 @@ int Paragraph::Private::startTeXParParams(BufferParams const & bparams, string const begin_tag = "\\begin"; InsetCode code = ownerCode(); bool const lastpar = runparams.isLastPar; + // RTL without the Bidi package switches the left/right logic + bool const rtl_classic = owner_->getParLanguage(bparams)->rightToLeft() + && !runparams.use_polyglossia; switch (curAlign) { case LYX_ALIGN_NONE: @@ -2287,13 +2290,13 @@ int Paragraph::Private::startTeXParParams(BufferParams const & bparams, case LYX_ALIGN_DECIMAL: break; case LYX_ALIGN_LEFT: { - if (!owner_->getParLanguage(bparams)->rightToLeft()) + if (!rtl_classic) corrected_env(os, begin_tag, "flushleft", code, lastpar, column); else corrected_env(os, begin_tag, "flushright", code, lastpar, column); break; } case LYX_ALIGN_RIGHT: { - if (!owner_->getParLanguage(bparams)->rightToLeft()) + if (!rtl_classic) corrected_env(os, begin_tag, "flushright", code, lastpar, column); else corrected_env(os, begin_tag, "flushleft", code, lastpar, column); @@ -2336,6 +2339,9 @@ bool Paragraph::Private::endTeXParParams(BufferParams const & bparams, string const end_tag = "\\par\\end"; InsetCode code = ownerCode(); bool const lastpar = runparams.isLastPar; + // RTL without the Bidi package switches the left/right logic + bool const rtl_classic = owner_->getParLanguage(bparams)->rightToLeft() + && !runparams.use_polyglossia; switch (curAlign) { case LYX_ALIGN_NONE: @@ -2345,13 +2351,13 @@ bool Paragraph::Private::endTeXParParams(BufferParams const & bparams, case LYX_ALIGN_DECIMAL: break; case LYX_ALIGN_LEFT: { - if (!owner_->getParLanguage(bparams)->rightToLeft()) + if (!rtl_classic) output = corrected_env(os, end_tag, "flushleft", code, lastpar, col); else output = corrected_env(os, end_tag, "flushright", code, lastpar, col); break; } case LYX_ALIGN_RIGHT: { - if (!owner_->getParLanguage(bparams)->rightToLeft()) + if (!rtl_classic) output = corrected_env(os, end_tag, "flushright", code, lastpar, col); else output = corrected_env(os, end_tag, "flushleft", code, lastpar, col); diff --git a/status.23x b/status.23x index 9c50dceb98..68c3a51151 100644 --- a/status.23x +++ b/status.23x @@ -83,6 +83,8 @@ What's new - Fix SVG to PNG image conversion problem with inkscape on Mac. On-screen display of SVG graphics was broken for e.g. users guide. +- Fix paragraph alignment in RTL when using polyglossia (bidi) (bug 11399). + * USER INTERFACE -- 2.39.5