- // TODO: This should be replaced with an improvement of
- // Cursor::moveToClosestEdge that handles rtl text. (Which could not
- // be tested because of #10569.)
- CoordCache::Insets const & insetCache = bv_->coordCache().getInsets();
- if (insetCache.has(inset)) {
- Dimension const & dim = insetCache.dim(inset);
- Point p = insetCache.xy(inset);
- bool const is_rtl = text_->isRTL(text_->getPar(pit));
- if (is_rtl) {
- // "in front of" == "right of"
- if (abs(p.x_ - x) < abs(p.x_ + dim.wid - x))
- cur.posForward();
- } else {
- // "in front of" == "left of"
- if (abs(p.x_ + dim.wid - x) < abs(p.x_ - x))
- cur.posForward();
- }
- }
+ bool bound = false; // is modified by getPosNearX
+ cur.pos() = getPosNearX(row, x, bound);
+ cur.boundary(bound);
+ cur.setCurrentFont();
+ cur.setTargetX(x);