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.
I've added
rtlLayout
option for using CodeMirror as a right to left text editor. Provided example page shows its usage which is in Persian language (just like Arabic). I created this example to explain how it should work and at the moment it has some issues.Rendered text and its styling is correct. But in this mode bidi algorithm's behavior must be changed. For example, in the following image, when I put my cursor in the beginning of the line, it stands after # character:
Also behavior of multi-cursor algorithm, must be changed. Following image shows that when I move cursor to beginning character of word, it shows two cursor. When you are typing Left to Right, this behavior is right because editor doesn't know your next character is RTL or LTR, but in
rtlLayout
it is nonsense. In this state if you type RTL or LTR characters, CodeMirror appends them under gray cursor which is correct behavior and the black cursor is useless:Finally, mouse click and text selection is completely non-predictable. The correct behavior is obvious: put cursor just under mouse position.
There is similar pull request #1103 which targets same problem but it seems that its changes are removed now. As I said, I've created this simple example for making clear the expected behavior of editor in Right to Left mode, so questions are welcome.