mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
Fix cursor movement inside insets within RTL mode.
* Bidi.{h,cpp}: - isWithinRtlParagraph(): new helper function. * Text2.cpp: use function above for cursor up and down instead of needReverseDirection() which is about cursor left and right. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18364 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
291b765a61
commit
e9780fe317
@ -224,4 +224,10 @@ bool reverseDirectionNeeded(Cursor const & cur)
|
||||
}
|
||||
|
||||
|
||||
bool isWithinRtlParagraph(Cursor const & cur)
|
||||
{
|
||||
return cur.innerParagraph().isRightToLeftPar(
|
||||
cur.bv().buffer()->params());
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -69,6 +69,9 @@ private:
|
||||
/// Should interpretation of the arrow keys be reversed?
|
||||
bool reverseDirectionNeeded(Cursor const & cur);
|
||||
|
||||
/// Is current paragraph in RTL mode?
|
||||
bool isWithinRtlParagraph(Cursor const & cur);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif // BIDI_H
|
||||
|
@ -998,8 +998,8 @@ bool Text::cursorUp(Cursor & cur)
|
||||
// handling when the cursor is at the end of line: Use the new
|
||||
// x-target only if the old one was before the end of line.
|
||||
if (cur.pos() != pm.rows()[row].endpos()
|
||||
|| (!reverseDirectionNeeded(cur) && x < cur.targetX())
|
||||
|| (reverseDirectionNeeded(cur) && x > cur.targetX())) {
|
||||
|| (!isWithinRtlParagraph(cur) && x < cur.targetX())
|
||||
|| (isWithinRtlParagraph(cur) && x > cur.targetX())) {
|
||||
|
||||
x = cur.targetX();
|
||||
}
|
||||
@ -1065,8 +1065,8 @@ bool Text::cursorDown(Cursor & cur)
|
||||
// handling when the cursor is at the end of line: Use the new
|
||||
// x-target only if the old one was before the end of line.
|
||||
if (cur.pos() != pm.rows()[row].endpos()
|
||||
|| (!reverseDirectionNeeded(cur) && x < cur.targetX())
|
||||
|| (reverseDirectionNeeded(cur) && x > cur.targetX())) {
|
||||
|| (!isWithinRtlParagraph(cur) && x < cur.targetX())
|
||||
|| (isWithinRtlParagraph(cur) && x > cur.targetX())) {
|
||||
|
||||
x = cur.targetX();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user