]> git.lyx.org Git - features.git/commitdiff
Row::Element::x2pos: go to nearest point also over insets
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 6 Apr 2017 13:13:24 +0000 (15:13 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 6 Apr 2017 13:18:15 +0000 (15:18 +0200)
getPosNearX, which is the only user of x2pos, should always return the
nearest position.

In editXY, there is a need to return the position where the inset
stands, but it is done using checkInsetHit.

This is a simplification of commit eb4a2a19, which has been reverted
at 01f0ab64a.

Fixes part of bug #10569.

src/Row.cpp

index 70e3dcafc3ac3683d72d4d9555e2b7a59df19fc3..3557957a77a8d79ea77fb7d35925b5b636ef54e0 100644 (file)
@@ -115,14 +115,13 @@ pos_type Row::Element::x2pos(int &x) const
        case SPACE:
                // those elements contain only one position. Round to
                // the closest side.
-               if (x > full_width()) {
+               if (x > full_width() / 2) {
                        x = int(full_width());
                        i = !isRTL();
                } else {
                        x = 0;
                        i = isRTL();
                }
-
        }
        //lyxerr << "=> p=" << pos + i << " x=" << x << endl;
        return pos + i;