1) boundary should not be set to true at a (intra-paragraph) line break; fixes this:
abc|\n -> move right -> abc\n (and not: abc\n| FED FED| FED ) 2) boundary should not be set (even if left_font is provided) at pos == 0; fixes this: abc\n -> toggle to RTL -> abc\n (and not: abc\n| | | ) This fixes some manifestations of http://bugzilla.lyx.org/show_bug.cgi?id=5061
# HG changeset patch # User Dov Feldstern <[EMAIL PROTECTED]> # Date 1226857936 -7200 # Node ID 5fa28578a852bd8dffb413457a674f61fde94de4 # Parent 8b73bd1b76ee5a0bd85b66dfcd4dbd3862cf7361 two fixes of RTL boundary calculation: 1) boundary should not be set to true at a (intra-paragraph) line break; fixes this: abc|\n -> move right -> abc\n (and not: abc\n| FED FED| FED ) 2) boundary should not be set (even if left_font is provided) at pos == 0; fixes this: abc\n -> toggle to RTL -> abc\n (and not: abc\n| | | ) This fixes some manifestations of http://bugzilla.lyx.org/show_bug.cgi?id=5061 diff -r 8b73bd1b76ee -r 5fa28578a852 src/TextMetrics.cpp --- a/src/TextMetrics.cpp Sun Nov 16 19:47:20 2008 +0200 +++ b/src/TextMetrics.cpp Sun Nov 16 19:52:16 2008 +0200 @@ -317,7 +317,7 @@ if (!lyxrc.rtl_support) return false; - // no RTL boundary at line start + // no RTL boundary at paragraph start if (pos == 0) return false; @@ -331,6 +331,23 @@ Font const & font) const { if (!lyxrc.rtl_support) + return false; + + // no RTL boundary at paragraph start + if (pos == 0) + return false; + + ParagraphMetrics & pm = par_metrics_[pit]; + // no RTL boundary in empty paragraph + if (pm.rows().empty()) + return false; + + pos_type endpos = pm.getRow(pos - 1, false).endpos(); + pos_type startpos = pm.getRow(pos, false).pos(); + // no RTL boundary at line start: + // abc\n -> toggle to RTL -> abc\n (and not: abc\n| + // | | ) + if (pos == startpos && pos == endpos) // start of cur row, end of prev row return false; Paragraph const & par = text_->getPar(pit); @@ -340,6 +357,16 @@ 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 ) + if (startpos == pos && endpos == pos && endpos != par.size() + && (par.isNewline(pos - 1) + || par.isLineSeparator(pos - 1) + || par.isSeparator(pos - 1))) + return false; + return left != right; }
