]> git.lyx.org Git - features.git/commitdiff
Fix logic error for spacing of RTL rows
authorJean-Marc <lasgouttes@lyx.org>
Thu, 24 Jul 2014 22:10:10 +0000 (00:10 +0200)
committerJean-Marc <lasgouttes@lyx.org>
Fri, 25 Jul 2014 17:59:37 +0000 (19:59 +0200)
The code referred to vpos (the visible position) instead of pos, the logical one.
This can lead to using the wrong font when computing spaces width.

src/rowpainter.cpp

index 5bd3209439634154ac3340bf71028d7fcd87abd6..bb2535f66c810dedaa4a7600ca962012e0b7a08f 100644 (file)
@@ -736,19 +736,19 @@ void RowPainter::paintText()
                }
 
                // Use font span to speed things up, see above
-               if (vpos < font_span.first || vpos > font_span.last) {
-                       font_span = par_.fontSpan(vpos);
-                       font = text_metrics_.displayFont(pit_, vpos);
+               if (!font_span.inside(pos)) {
+                       font_span = par_.fontSpan(pos);
+                       font = text_metrics_.displayFont(pit_, pos);
 
                        // split font span if inline completion is inside
-                       if (font_span.first <= inlineCompletionVPos
-                           && font_span.last > inlineCompletionVPos)
-                               font_span.last = inlineCompletionVPos;
+                       if (inlineCompletionVPos != -1
+                           && font_span.inside(inlineCompletionPos.pos()))
+                               font_span.last = inlineCompletionPos.pos();
                }
 
                // Note that this value will only be used in
                // situations where no ligature of composition of
-               // characters is needed. (see comments alginuses of width_pos).
+               // characters is needed. (see comments in uses of width_pos).
                const int width_pos = pm_.singleWidth(pos, font);
 
                Change const & change = par_.lookupChange(pos);