Improve moveByCharacter for rtl text #233
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Users expect the arrow keys to move the cursor at the direction the arrow is pointing to. However, in right-to-left languages, since the text is written right-to-left, the cursor currently moves in the OPPOSITE direction of the arrow.
This change flips the direction of the movement if the whole line is made out of rtl language characters. While this isn't a thorough treatment for rtl support (the behavior is as before for lines of mixed rtl/ltr characters), it is a low hanging fruit that improves the experience by a lot for the standard case of writing in one language.
WDYT?
What changed
If a line contains only rtl language characters, arrows will move at the directions they point to.
Test plan
npm dev
application on the following strings:Example
example.mov
If accepted, I can also add some automated test.