]> git.lyx.org Git - features.git/commitdiff
When using polyglossia (bidi), paragraph directions don't need to be swapped
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 7 Jan 2019 12:54:23 +0000 (13:54 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 8 Jan 2019 07:30:42 +0000 (08:30 +0100)
Bidi does that.

Fixes: #11399
(cherry picked from commit 9d20bc4e989c57dc5498f231d890a0550375a753)

src/Paragraph.cpp
status.23x

index a16437ddace37d2012aee38e35c9083af110a3f2..c8c42042c65cd888ef3bd366e75d014aea63eb8d 100644 (file)
@@ -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);
index 9c50dceb989c2f0340a1f3ab89bd1a4288dea3b9..68c3a511517a7e7bde66d3cc46669d26439ac15c 100644 (file)
@@ -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