X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBidi.cpp;h=3b598a4fbd1087c3969a091889328077d4957123;hb=ecdeffb52b1dad2f56e0e4210d0a040e807e2caf;hp=d00b8eb72dada03a17df1f93f148deb2d4ba2bd6;hpb=a8cd9a4b8fd325b00c75f601c66c6d618ba276db;p=lyx.git diff --git a/src/Bidi.cpp b/src/Bidi.cpp index d00b8eb72d..3b598a4fbd 100644 --- a/src/Bidi.cpp +++ b/src/Bidi.cpp @@ -46,6 +46,7 @@ bool Bidi::inRange(pos_type pos) const return start_ == -1 || (start_ <= pos && pos <= end_); } + bool Bidi::same_direction() const { return same_direction_; @@ -56,12 +57,8 @@ void Bidi::computeTables(Paragraph const & par, Buffer const & buf, Row const & row) { same_direction_ = true; - if (!lyxrc.rtl_support) { - start_ = -1; - return; - } - if (par.ownerCode() == ERT_CODE || par.ownerCode() == LISTINGS_CODE) { + if (par.inInset().forceLTR()) { start_ = -1; return; } @@ -107,19 +104,21 @@ void Bidi::computeTables(Paragraph const & par, pos_type const pos = (is_space && lpos + 1 <= end_ && !par.isLineSeparator(lpos + 1) && + !par.isEnvSeparator(lpos + 1) && !par.isNewline(lpos + 1)) ? lpos + 1 : lpos; - Font font = par.getFontSettings(bufparams, pos); - if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() && - font.fontInfo().number() == FONT_ON && + + Font const * font = &(par.getFontSettings(bufparams, pos)); + if (pos != lpos && 0 < lpos && rtl0 && font->isRightToLeft() && + font->fontInfo().number() == FONT_ON && par.getFontSettings(bufparams, lpos - 1).fontInfo().number() == FONT_ON) { - font = par.getFontSettings(bufparams, lpos); + font = &(par.getFontSettings(bufparams, lpos)); is_space = false; } + bool new_rtl = font->isVisibleRightToLeft(); + bool new_rtl0 = font->isRightToLeft(); - bool new_rtl = font.isVisibleRightToLeft(); - bool new_rtl0 = font.isRightToLeft(); int new_level; if (lpos == body_pos - 1 @@ -189,7 +188,7 @@ void Bidi::computeTables(Paragraph const & par, bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par, pos_type pos) const { - if (!lyxrc.rtl_support || pos == 0) + if (pos == 0) return false; if (!inRange(pos - 1)) { @@ -209,9 +208,6 @@ bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par, bool Bidi::isBoundary(Buffer const & buf, Paragraph const & par, pos_type pos, Font const & font) const { - if (!lyxrc.rtl_support) - return false; // This is just for speedup - bool const rtl = font.isVisibleRightToLeft(); bool const rtl2 = inRange(pos) ? level(pos) % 2