Details

    Description

      The current cursor position assignment is not ideal for bi-directional text in the following case (suppose abc is LTR text and ABC is RTL text).

      1. Given a string "abcABCabc":

      1) If the cursor position is 3, the actual layout will show as "abcCBA|abc", where '|' represents the cursor;
      2) If the cursor position is 6, the actual layout will also show as "abcCBA|abc".

      There is no way to distinguish these two cases visually, unless we move the cursor again, this visual position has been occupied twice with two different logical positions, which caused ambiguity. Plus, there is no way to move the cursor to make the visual rendering like "abc|CBAabc", that visual position is never occupied.

      2. Given a string "ABCabcABC":

      1) If the cursor position is 3, the actual layout (right aligned) will show as "CBA|abcCBA";
      2) If the cursor position is 6, the actual layout will also show as "CBA|abcCBA".

      The same problems as above.

      Given the problems above, I propose a reassignment of cursor positions to solve them:

      For each QScriptItem with the same direction as the block direction (LTR item in a LTR block, RTL item in a RTL block), if the cursor position equals the starting position of this item, treat it as the end of previous item (QTextEngine::findItem(pos - 1)).

      After that, in above case 1., cursor position 6 will appear as "abc|CBAabc", in case 2., cursor position 6 will appear as "CBAabc|CBA", so that cursor position 3 and 6 will not use the same visual position, and the cursor can be placed between the first and second item now.

      I think this new assignment makes more sense for bi-directional text and it won't affect any other situations.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jiang Jiang Jiang
            jiang Jiang Jiang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes