From b82137ef185d95505180f39e1d8d67a9ca3a4f49 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 6 Apr 2017 15:13:24 +0200 Subject: [PATCH] Row::Element::x2pos: go to nearest point also over insets 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. Fixes part of bug #10569. (cherry picked from commit 8769c0fb750a8c46e6f053c5f73b3991393dcd73) (cherry picked from commit 20696ecb7ee335dedcc8a1b0d24e4cc56736d81f) --- src/Row.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Row.cpp b/src/Row.cpp index f19a40bf60..662b5dc2f4 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -99,14 +99,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() + 1) / 2) { x = int(full_width()); i = !isRTL(); } else { x = 0; i = isRTL(); } - } //lyxerr << "=> p=" << pos + i << " x=" << x << endl; return pos + i;