X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText2.cpp;h=b7dc9a13d60373425bf835bd9eebf70d52594ef0;hb=4056f0ddb150d0e5d60bc5941d51e365eed0ac86;hp=fff739ed47a37419a504372e2d654ec9c1aae773;hpb=a19557baf76c7e2fd1c75f1d415b9719ab68cb4e;p=lyx.git diff --git a/src/Text2.cpp b/src/Text2.cpp index fff739ed47..b7dc9a13d6 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -199,7 +199,7 @@ void Text::setLayout(Buffer const & buffer, pit_type start, pit_type end, BOOST_ASSERT(start != end); BufferParams const & bufparams = buffer.params(); - LayoutPtr const & lyxlayout = bufparams.getTextClass()[layout]; + LayoutPtr const & lyxlayout = bufparams.textClass()[layout]; for (pit_type pit = start; pit != end; ++pit) { Paragraph & par = pars_[pit]; @@ -218,7 +218,7 @@ void Text::setLayout(Cursor & cur, docstring const & layout) // special handling of new environment insets BufferView & bv = cur.bv(); BufferParams const & params = bv.buffer().params(); - LayoutPtr const & lyxlayout = params.getTextClass()[layout]; + LayoutPtr const & lyxlayout = params.textClass()[layout]; if (lyxlayout->is_environment) { // move everything in a new environment inset LYXERR(Debug::DEBUG, "setting layout " << to_utf8(layout)); @@ -711,10 +711,20 @@ bool Text::cursorVisLeft(Cursor & cur, bool skip_inset) // position 'left_pos' + 1. if (new_pos_is_RTL) { new_pos = left_pos + 1; - // if the position *after* left_pos is not RTL, set boundary to - // true (we want to be *after* left_pos, not before left_pos + 1!) - new_boundary = !cur.paragraph().getFontSettings( - cur.bv().buffer().params(), new_pos).isVisibleRightToLeft(); + // set the boundary to true in two situations: + if ( + // 1. if new_pos is now lastpos (which means that we're moving left + // to the end of an RTL chunk which is at the end of an LTR + // paragraph); + new_pos == cur.lastpos() + // 2. if the position *after* left_pos is not RTL (we want to be + // *after* left_pos, not before left_pos + 1!) + || !cur.paragraph().getFontSettings(cur.bv().buffer().params(), + new_pos).isVisibleRightToLeft() + ) + new_boundary = true; + else // set the boundary to false + new_boundary = false; } // Otherwise (if the character at position 'left_pos' is LTR), then // moving to the left of it is as easy as setting the new position @@ -791,10 +801,20 @@ bool Text::cursorVisRight(Cursor & cur, bool skip_inset) // position 'right_pos' + 1. if (!new_pos_is_RTL) { new_pos = right_pos + 1; - // if the position *after* right_pos is RTL, set boundary to - // true (we want to be *after* right_pos, not before right_pos + 1!) - new_boundary = cur.paragraph().getFontSettings( - cur.bv().buffer().params(), new_pos).isVisibleRightToLeft(); + // set the boundary to true in two situations: + if ( + // 1. if new_pos is now lastpos (which means that we're moving + // right to the end of an LTR chunk which is at the end of an + // RTL paragraph); + new_pos == cur.lastpos() + // 2. if the position *after* right_pos is RTL (we want to be + // *after* right_pos, not before right_pos + 1!) + || cur.paragraph().getFontSettings(cur.bv().buffer().params(), + new_pos).isVisibleRightToLeft() + ) + new_boundary = true; + else // set the boundary to false + new_boundary = false; } // Otherwise (if the character at position 'right_pos' is RTL), then // moving to the right of it is as easy as setting the new position