X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FRow.cpp;h=cc78cff3390f8e3579164155f98f90b0174b4d07;hb=eb4a2a190f2640d2a6ab7146cfcc347e70b57044;hp=70e3dcafc3ac3683d72d4d9555e2b7a59df19fc3;hpb=86d9abeea7f9a0c0c7b63540ea20c41264cde991;p=features.git diff --git a/src/Row.cpp b/src/Row.cpp index 70e3dcafc3..cc78cff339 100644 --- a/src/Row.cpp +++ b/src/Row.cpp @@ -95,7 +95,7 @@ double Row::Element::pos2x(pos_type const i) const } -pos_type Row::Element::x2pos(int &x) const +pos_type Row::Element::x2pos(int &x, bool const select) const { //lyxerr << "x2pos: x=" << x << " w=" << width() << " " << *this; size_t i = 0; @@ -112,17 +112,18 @@ pos_type Row::Element::x2pos(int &x) const x = isRTL() ? int(full_width()) : 0; break; case INSET: - case SPACE: + case SPACE: { + int const boundary = select ? (full_width() + 1) / 2 : full_width(); // those elements contain only one position. Round to // the closest side. - if (x > full_width()) { + if (x > boundary) { x = int(full_width()); i = !isRTL(); } else { x = 0; i = isRTL(); } - + } } //lyxerr << "=> p=" << pos + i << " x=" << x << endl; return pos + i;