commit 89dca6d3a98c48883b41ae66bdd26e909f39f83d
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Fri Nov 6 14:28:05 2015 +0100

    Be careful about accounting for the right margin
    
    In computeRowMetrics, the right margin of the row shall be taken in account 
when the text is not left-aligned. Rewrite the code in terms of the available 
width `w' to avoid this pitfall.

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 2ec798f..cd7beb2 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -590,10 +590,10 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
                        if (ns && !row.right_boundary()
                            && row.endpos() != par.size()) {
                                row.setSeparatorExtraWidth(double(w) / ns);
-                               row.dimension().wid = width;
+                               row.dimension().wid += w;
                        } else if (text_->isRTL(par)) {
-                               row.dimension().wid = width;
                                row.left_margin += w;
+                               row.dimension().wid += w;
                        }
                        break;
                }
@@ -602,7 +602,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
                        row.dimension().wid += w;
                        break;
                case LYX_ALIGN_CENTER:
-                       row.dimension().wid = width - w / 2;
+                       row.dimension().wid += w / 2;
                        row.left_margin += w / 2;
                        break;
                case LYX_ALIGN_LEFT:

Reply via email to