Re: RTL cursor movement
Op 23-07-19 om 07:41 schreef Jürgen Spitzmüller: Am Dienstag, den 23.07.2019, 06:40 +0200 schrieb Jürgen Spitzmüller: I see. This makes sense. I will update the docs. This is what I came up with: Right-to-left cursor movement: Here you can define how cursor movement (with the arrow keys) behaves when writing scripts with right-to-left direction (e.g., Arabic, Hebrew or Farsi). Logical means that the cursor follows the logic of the text direction, and the arrows’ direction relates to the directionality of the main paragraph language. E. g., in embedded right-to-left text in a left-to- right paragraph (say, Hebrew embedded in English), the cursor starts at the right (that is, at the beginning of the embedded passage in the right-to-left logic) when coming from the left. The meaning of the key is thus swapped for that part; right arrow in this specific case always means: move forward in text (even if this means: move left). This setting might be useful in texts that mix left-to-right and right-to- left scripts, since the cursor then follows a coherent “text logic”. Visual means: always move to the direction towards which the arrows really point. In this case, in embedded right-to-left text in a left- to-right paragraph, the cursor starts at the left (in the text logic: from the end) when coming from the left. The visual meaning of the key is thus maintained in all cases, at the expense of the text logic. Jürgen Looks good. You have worded it better than I did. Thanks. Cor
Re: RTL cursor movement
Am Dienstag, den 23.07.2019, 06:40 +0200 schrieb Jürgen Spitzmüller: > I see. This makes sense. I will update the docs. This is what I came up with: Right-to-left cursor movement: Here you can define how cursor movement (with the arrow keys) behaves when writing scripts with right-to-left direction (e.g., Arabic, Hebrew or Farsi). Logical means that the cursor follows the logic of the text direction, and the arrows’ direction relates to the directionality of the main paragraph language. E. g., in embedded right-to-left text in a left-to- right paragraph (say, Hebrew embedded in English), the cursor starts at the right (that is, at the beginning of the embedded passage in the right-to-left logic) when coming from the left. The meaning of the key is thus swapped for that part; right arrow in this specific case always means: move forward in text (even if this means: move left). This setting might be useful in texts that mix left-to-right and right-to- left scripts, since the cursor then follows a coherent “text logic”. Visual means: always move to the direction towards which the arrows really point. In this case, in embedded right-to-left text in a left- to-right paragraph, the cursor starts at the left (in the text logic: from the end) when coming from the left. The visual meaning of the key is thus maintained in all cases, at the expense of the text logic. Jürgen signature.asc Description: This is a digitally signed message part
Re: RTL cursor movement
Am Montag, den 22.07.2019, 21:33 +0200 schrieb Cor Blom: > I use logical navigation. What I expect is that with logical > navigation > the direction is determined by the direction (RTL or LTR) of the > whole > paragraph. When in the paragraph a few words have an alternative > direction (such as a couple of RTL words in LTR text) than with > those > words the cursor movement is going backwards, following the direction > of > the text, but also following the logic of what is forwards and > backwards > of the surrounding text. > > With visual navigation the cursor always follows the direction of > the > main direction of the paragraph, ignoring words that have a > different > direction. > > This is how is works for me in 2.3.3. I see. This makes sense. I will update the docs. Jürgen signature.asc Description: This is a digitally signed message part
Re: RTL cursor movement
Op 22-07-19 om 20:06 schreef Jean-Marc Lasgouttes: We could also wonder whether anybody misses the logical navigation... I use logical navigation. What I expect is that with logical navigation the direction is determined by the direction (RTL or LTR) of the whole paragraph. When in the paragraph a few words have an alternative direction (such as a couple of RTL words in LTR text) than with those words the cursor movement is going backwards, following the direction of the text, but also following the logic of what is forwards and backwards of the surrounding text. With visual navigation the cursor always follows the direction of the main direction of the paragraph, ignoring words that have a different direction. This is how is works for me in 2.3.3. Cor
Re: RTL cursor movement
Le 22/07/2019 à 18:58, Jürgen Spitzmüller a écrit : 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. We could also wonder whether anybody misses the logical navigation... JMarc
Re: RTL cursor movement
Le 22/07/2019 à 18:58, Jürgen Spitzmüller a écrit : 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. It is weird that this needs to be redone. I am use it used to work not so long ago. I'll have to try 2.2 and 2.1, it is already broken with LyX 2.3.3. JMarc
Re: RTL cursor movement
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
RTL cursor movement
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. Can anyone enlighten me (or is this pref simply broken)? Jürgen signature.asc Description: This is a digitally signed message part