Skip to content

Conversation

ranyadshalom
Copy link

@ranyadshalom ranyadshalom commented May 20, 2025

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

  1. I tested with the local npm dev application on the following strings:
זה טקסט בעברית לבדיקה.
هذه هي اللغة العربية للاختبار.

זה טקסט with English.
And this is מעורבב גם כן.
ועכשיו מילה yes ומילה no.
  1. made sure the behavior for English stayed the same.
  2. ran the test suite

Example

example.mov

If accepted, I can also add some automated test.

@ranyadshalom ranyadshalom marked this pull request as ready for review May 20, 2025 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant