]> git.lyx.org Git - lyx.git/commitdiff
Small fixes to cursor positioning.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 20 Dec 2013 11:12:27 +0000 (12:12 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 25 Jun 2014 15:55:30 +0000 (17:55 +0200)
Two small fixed to Row::Element::x2pos:
* fix position for elements that are not strings
* make rounding match the old code

src/Row.cpp

index d7940e92e9802548c1df0a0197aa49fd8b97e6fc..86b7d06ce6dcac2697f04557344c1d9813c1cb5b 100644 (file)
@@ -86,10 +86,12 @@ pos_type Row::Element::x2pos(double &x, bool const low) const
                //      lyxerr << " NOT FOUND ";
        }
 
-       if (i == str.size())
+       if (type == STRING && i == str.size())
                x2 = w;
-       // round to the closest side
-       else if (!low && (x2 - last_w > w - x2)) {
+       // round to the closest side. The !rtl is here to obtain the
+       // same rounding as with the old code (this is cosmetic and
+       // can be eventually removed).
+       else if (!low && (x2 - last_w + !rtl > w - x2)) {
                x2 = w;
                ++i;
        } else