X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbufferview_funcs.cpp;h=3f132de962d585d3c1366832038f27a22a5988cc;hb=4734433a3ccc287a63fe48726e354e78bc481a81;hp=e8c3eff286ef527150525a3012ca6edecb07cb11;hpb=8319910995fdfaa1cd401d2a82cfbd79accd4bf5;p=lyx.git diff --git a/src/bufferview_funcs.cpp b/src/bufferview_funcs.cpp index e8c3eff286..3f132de962 100644 --- a/src/bufferview_funcs.cpp +++ b/src/bufferview_funcs.cpp @@ -178,11 +178,16 @@ Point coordOffset(BufferView const & bv, DocIterator const & dit, bool rtl = bv.textMetrics(sl.text()).isRTL(sl, boundary_i); if (rtl) x -= lastw; + // remember width for the case that sl.inset() is positioned in an RTL inset + Dimension const & dim = bv.parMetrics(sl.text(), sl.pit()). + insetDimension(&sl.inset()); + lastw = dim.wid; + } else { + // remember width for the case that sl.inset() is positioned in an RTL inset + Dimension const dim = sl.inset().dimension(bv); + lastw = dim.wid; } - // remember width for the case that sl.inset() is positioned in an RTL inset - lastw = sl.inset().width(); - //lyxerr << "Cursor::getPos, i: " // << i << " x: " << xx << " y: " << y << endl; } @@ -247,18 +252,10 @@ CurStatus status(BufferView const * bv, DocIterator const & dit) { // FIXME: it's be better to have something like TextMetrics::status(). TextMetrics const & tm = bv->textMetrics(dit.bottom().text()); - pit_type const pit = dit.bottom().pit(); - if (!tm.has(pit)) { - if (dit.bottom().pit() < bv->anchor_ref()) - return CUR_ABOVE; - else - return CUR_BELOW; - } - - ParagraphMetrics const & pm = tm.parMetrics(pit); - if (pm.position() < 0) + int par_pos = tm.parPosition(dit.bottom().pit()); + if (par_pos < 0) return CUR_ABOVE; - else if (pm.position() > bv->workHeight()) + else if (par_pos > bv->workHeight()) return CUR_BELOW; return CUR_INSIDE; @@ -277,7 +274,7 @@ bool findNextInset(DocIterator & dit, if (inset && find(codes.begin(), codes.end(), inset->lyxCode()) != codes.end() && (contents.empty() || - static_cast(inset)->getContents() == contents)) { + static_cast(inset)->getContents() == contents)) { dit = tmpdit; return true; }