]> git.lyx.org Git - lyx.git/commitdiff
Fix display of math hull inset in RTL context
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 16 May 2024 12:56:28 +0000 (14:56 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 1 Jun 2024 19:47:53 +0000 (21:47 +0200)
The inversion of margin was done in the wrong way for RTL support.

(cherry picked from commit b469c142ad579d3338fc81ab3e1c6ee7b4e270ec)

src/TextMetrics.cpp
status.24x

index 6968279c239d01df0f2afa09c09978f151b72f42..a694c997ea36cc0afebc51bac3a5f8697659ba98 100644 (file)
@@ -2001,8 +2001,14 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const
                return;
        size_t const nrows = pm.rows().size();
        // Remember left and right margin for drawing math numbers
-       Changer changeleft = changeVar(pi.leftx, x + leftMargin(pit));
-       Changer changeright = changeVar(pi.rightx, x + width() - rightMargin(pit));
+       Changer changeleft, changeright;
+       if (text_->isRTL(pit)) {
+               changeleft = changeVar(pi.leftx, x + rightMargin(pit));
+               changeright = changeVar(pi.rightx, x + width() - leftMargin(pit));
+       } else {
+               changeleft = changeVar(pi.leftx, x + leftMargin(pit));
+               changeright = changeVar(pi.rightx, x + width() - rightMargin(pit));
+       }
 
        // Use fast lane in nodraw stage.
        if (pi.pain.isNull()) {
@@ -2049,9 +2055,6 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const
                }
        }
 
-       if (text_->isRTL(pit))
-               swap(pi.leftx, pi.rightx);
-
        BookmarksSection::BookmarkPosList bpl =
                theSession().bookmarks().bookmarksInPar(bv_->buffer().fileName(), pm.id());
 
index f3e8f6b07caf1cb25ff65a12834612591cf6ddcc..154a255304b2ddf51f88141f284eaf527bf204f8 100644 (file)
@@ -41,6 +41,7 @@ What's new
 
 * USER INTERFACE
 
+- fix display of equation numbers in right-to-left context.
 
 * INTERNALS