X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FTextMetrics.cpp;h=19a71ffbb99154ad41ed597c0ab4431929aaf0b5;hb=c0f4aa8c4b786dcfb3699b175dff63f109abba98;hp=6fca429b5aa70fade5e956741eda005297e96664;hpb=4d0d67872e8d97658b9e5e10d290c7942f14dfa4;p=lyx.git diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 6fca429b5a..19a71ffbb9 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -322,16 +322,12 @@ bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos) const bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos, Font const & font) const { - if (!lyxrc.rtl_support) - return false; - - // no RTL boundary at paragraph start - if (pos == 0) - return false; - - // if the metrics have not been calculated, then we are not - // on screen and can safely ignore issues about boundaries. - if (!contains(pit)) + if (!lyxrc.rtl_support + // no RTL boundary at paragraph start + || pos == 0 + // if the metrics have not been calculated, then we are not + // on screen and can safely ignore issues about boundaries. + || !contains(pit)) return false; ParagraphMetrics & pm = par_metrics_[pit]; @@ -348,13 +344,6 @@ bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos, return false; Paragraph const & par = text_->getPar(pit); - bool left = font.isVisibleRightToLeft(); - bool right; - if (pos == par.size()) - right = par.isRTL(bv_->buffer().params()); - else - right = displayFont(pit, pos).isVisibleRightToLeft(); - // no RTL boundary at line break: // abc|\n -> move right -> abc\n (and not: abc\n| // FED FED| FED ) @@ -364,6 +353,13 @@ bool TextMetrics::isRTLBoundary(pit_type pit, pos_type pos, || par.isSeparator(pos - 1))) return false; + bool left = font.isVisibleRightToLeft(); + bool right; + if (pos == par.size()) + right = par.isRTL(bv_->buffer().params()); + else + right = displayFont(pit, pos).isVisibleRightToLeft(); + return left != right; }