mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
* Cursor.cpp: cosmetics.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28627 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
28cb308313
commit
e990b98cfd
@ -836,35 +836,29 @@ void Cursor::posVisToRowExtremity(bool left)
|
|||||||
// "boundary" which we simulate at insets.
|
// "boundary" which we simulate at insets.
|
||||||
// Another exception is when row.endpos() is 0.
|
// Another exception is when row.endpos() is 0.
|
||||||
|
|
||||||
bool right_of_pos = false; // do we want to be to the right of pos?
|
// do we want to be to the right of pos?
|
||||||
|
|
||||||
// as explained above, if at last pos in row, stay to the right
|
// as explained above, if at last pos in row, stay to the right
|
||||||
if (row.endpos() > 0 && pos() == row.endpos() - 1
|
bool const right_of_pos = row.endpos() > 0
|
||||||
&& !par.isInset(pos()))
|
&& pos() == row.endpos() - 1 && !par.isInset(pos());
|
||||||
right_of_pos = true;
|
|
||||||
|
|
||||||
// Now we know if we want to be to the left or to the right of pos,
|
// Now we know if we want to be to the left or to the right of pos,
|
||||||
// let's make sure we are where we want to be.
|
// let's make sure we are where we want to be.
|
||||||
bool new_pos_is_RTL =
|
bool const new_pos_is_RTL =
|
||||||
par.getFontSettings(buf.params(), pos()).isVisibleRightToLeft();
|
par.getFontSettings(buf.params(), pos()).isVisibleRightToLeft();
|
||||||
|
|
||||||
if (new_pos_is_RTL == !right_of_pos) {
|
if (new_pos_is_RTL != right_of_pos) {
|
||||||
++pos();
|
++pos();
|
||||||
boundary(true);
|
boundary(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else { // move to rightmost position
|
// move to rightmost position
|
||||||
// if this is an LTR paragraph, and we're at the last row in the
|
// if this is an LTR paragraph, and we're at the last row in the
|
||||||
// paragraph, move to lastpos
|
// paragraph, move to lastpos
|
||||||
if (!par.isRTL(buf.params()) && row.endpos() == lastpos())
|
if (!par.isRTL(buf.params()) && row.endpos() == lastpos())
|
||||||
pos() = lastpos();
|
pos() = lastpos();
|
||||||
else {
|
else {
|
||||||
if (row.endpos() > 0)
|
pos() = row.endpos() > 0 ? bidi.vis2log(row.endpos() - 1) : 0;
|
||||||
pos() = bidi.vis2log(row.endpos() - 1);
|
|
||||||
else
|
|
||||||
pos() = 0;
|
|
||||||
|
|
||||||
// Moving to the rightmost position in the row, the cursor should
|
// Moving to the rightmost position in the row, the cursor should
|
||||||
// normally be placed to the *right* of the rightmost position.
|
// normally be placed to the *right* of the rightmost position.
|
||||||
@ -891,17 +885,15 @@ void Cursor::posVisToRowExtremity(bool left)
|
|||||||
// "boundary" which we simulate at insets.
|
// "boundary" which we simulate at insets.
|
||||||
// Another exception is when row.endpos() is 0.
|
// Another exception is when row.endpos() is 0.
|
||||||
|
|
||||||
bool left_of_pos = false; // do we want to be to the left of pos?
|
// do we want to be to the left of pos?
|
||||||
|
|
||||||
// as explained above, if at last pos in row, stay to the left,
|
// as explained above, if at last pos in row, stay to the left,
|
||||||
// unless the last position is the same as the first.
|
// unless the last position is the same as the first.
|
||||||
if (row.endpos() > 0 && pos() == row.endpos() - 1
|
bool const left_of_pos = row.endpos() > 0
|
||||||
&& !par.isInset(pos()))
|
&& pos() == row.endpos() - 1 && !par.isInset(pos()));
|
||||||
left_of_pos = true;
|
|
||||||
|
|
||||||
// Now we know if we want to be to the left or to the right of pos,
|
// Now we know if we want to be to the left or to the right of pos,
|
||||||
// let's make sure we are where we want to be.
|
// let's make sure we are where we want to be.
|
||||||
bool new_pos_is_RTL =
|
bool const new_pos_is_RTL =
|
||||||
par.getFontSettings(buf.params(), pos()).isVisibleRightToLeft();
|
par.getFontSettings(buf.params(), pos()).isVisibleRightToLeft();
|
||||||
|
|
||||||
if (new_pos_is_RTL == left_of_pos) {
|
if (new_pos_is_RTL == left_of_pos) {
|
||||||
|
Loading…
Reference in New Issue
Block a user