From: Jean-Marc Lasgouttes Date: Fri, 20 Dec 2013 11:12:27 +0000 (+0100) Subject: Small fixes to cursor positioning. X-Git-Tag: 2.2.0alpha1~1761^2~23 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9ba97a85f06c6f0272d43e61a86cceefbec8fa29;p=lyx.git Small fixes to cursor positioning. Two small fixed to Row::Element::x2pos: * fix position for elements that are not strings * make rounding match the old code --- diff --git a/src/Row.cpp b/src/Row.cpp index d7940e92e9..86b7d06ce6 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -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