Am Sonntag, den 21.07.2019, 12:30 +0200 schrieb Jürgen Spitzmüller: > I wanted to add a tooltip to the RTL cursor movement items in Prefs > > Language, but I am unable to find out what it actually does. I would > expect that the left/right arrow keys behave differently in RTL > context > depending on whether "Logical" or "Visual" is selected, but this does > not seem to be the case.
FYI the attached patch sort of restores the behavior I would expect (and that is described in the UG). This patch is unfinished, though. Navigating into insets with Logical movement does not yet work. Jürgen
diff --git a/src/Text2.cpp b/src/Text2.cpp index f1decc56f4..d0964f1054 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -645,7 +645,7 @@ bool Text::cursorBackward(Cursor & cur) } // go left and try to enter inset - if (checkAndActivateInset(cur, false)) + if (checkAndActivateInset(cur, !lyxrc.visual_cursor && cur.reverseDirectionNeeded())) return false; // normal character left @@ -699,7 +699,7 @@ bool Text::cursorForward(Cursor & cur) // not at paragraph end? if (cur.pos() != cur.lastpos()) { // in front of editable inset, i.e. jump into it? - if (checkAndActivateInset(cur, true)) + if (checkAndActivateInset(cur, lyxrc.visual_cursor || !cur.reverseDirectionNeeded())) return false; TextMetrics const & tm = cur.bv().textMetrics(this); diff --git a/src/Text3.cpp b/src/Text3.cpp index f234c7cb7d..deeb26f0b0 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -849,14 +849,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_LEFT); } - } else { - if (cur.reverseDirectionNeeded()) { - cmd.setAction(cmd.action() == LFUN_CHAR_LEFT_SELECT ? - LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD); - } else { - cmd.setAction(cmd.action() == LFUN_CHAR_LEFT_SELECT ? - LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD); - } + } else {// logical cursor movement + cmd.setAction(cmd.action() == LFUN_CHAR_LEFT_SELECT ? + LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD); dispatch(cur, cmd); return; } @@ -873,14 +868,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_RIGHT); } - } else { - if (cur.reverseDirectionNeeded()) { - cmd.setAction(cmd.action() == LFUN_CHAR_RIGHT_SELECT ? - LFUN_CHAR_BACKWARD_SELECT : LFUN_CHAR_BACKWARD); - } else { - cmd.setAction(cmd.action() == LFUN_CHAR_RIGHT_SELECT ? + } else {// logical cursor movement + cmd.setAction(cmd.action() == LFUN_CHAR_RIGHT_SELECT ? LFUN_CHAR_FORWARD_SELECT : LFUN_CHAR_FORWARD); - } dispatch(cur, cmd); return; } @@ -1007,14 +997,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_RIGHT); } - } else { - if (cur.reverseDirectionNeeded()) { - cmd.setAction(cmd.action() == LFUN_WORD_RIGHT_SELECT ? - LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD); - } else { - cmd.setAction(cmd.action() == LFUN_WORD_RIGHT_SELECT ? - LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD); - } + } else {// logical cursor movement + cmd.setAction(cmd.action() == LFUN_WORD_RIGHT_SELECT ? + LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD); dispatch(cur, cmd); return; } @@ -1059,14 +1044,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) cur.undispatched(); cmd = FuncRequest(LFUN_FINISHED_LEFT); } - } else { - if (cur.reverseDirectionNeeded()) { - cmd.setAction(cmd.action() == LFUN_WORD_LEFT_SELECT ? - LFUN_WORD_FORWARD_SELECT : LFUN_WORD_FORWARD); - } else { - cmd.setAction(cmd.action() == LFUN_WORD_LEFT_SELECT ? - LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD); - } + } else {// logical cursor movement + cmd.setAction(cmd.action() == LFUN_WORD_LEFT_SELECT ? + LFUN_WORD_BACKWARD_SELECT : LFUN_WORD_BACKWARD); dispatch(cur, cmd); return; }
signature.asc
Description: This is a digitally signed message part