Open dhoverml opened 6 months ago
( ), { }, [ ], are confusing since the opposite brace appears, though I don't know what the expected behavior should be.
This and neutral characters jumping is expected (all other UI toolkits I have tested act exactly the same way). Since the first character is Arabic, the base direction of the string is RTL and neutral characters are considered to be RTL as long as they aren't part of RTL run.
Cursor jumping is also expected (other UI toolkits do the same). Note: this is not how cursor in the native macOS text fields works, but macOS is an exception.
Qt 6.5.1 for example:
https://github.com/godotengine/godot/assets/7645683/a8bbebb8-8a3b-48ca-bc09-23daff62093d
But I guess we can add an option to use macOS style "visual" caret movement, in addition to the current one (won't be easy to do, due to the way selection works).
After comparing Godot with other applications when mixing LTR and RTL (bidi?), I think this bug can be closed.
However I'm leaving it open since I think some documentation should be added (to https://docs.godotengine.org/en/stable/tutorials/i18n/internationalizing_games.html) to explain:
Even though this behavior (except 3 and 4) can be seen in other applications, I think it could be helpful since it can differ enough to warrant an explanation.
Also, not this bug exactly, but I still have trouble navigating a LineEdit with the arrow keys when it mixes LTR and RTL. The cursor changes direction depending on where it is. I understand why it does it, but it isn't always obvious as a user. Other applications (Browser URL bar, Ubuntu Settings search, GEdit) did not exhibit this behavior: when you press left-arrow, the cursor moves left. When you press right arrow, the cursor moves right. Maybe this is what @bruvzg meant by "visual" caret movement?
Also, not this bug exactly, but I still have trouble navigating a LineEdit with the arrow keys when it mixes LTR and RTL. The cursor changes direction depending on where it is.
This is also expected and used by a lot (probably most) UI toolkits, the cursor moves the same way text is stored, pressing left moves it to the next character (so if it's on RTL portion of the text it will move right).
when you press left-arrow, the cursor moves left.
That's what I meant by "visual" (never saw this type of behavior outside of macOS).
There's no standard how to show it (I have seen arrows, vertical splits, color and similar "brackets", or nothing in the different OSes/toolkits), so documenting it would make sense.
Tested versions
v4.3.dev5.official [89f70e98d]
System information
Apple M1, Ubuntu 20.04 LTS
Issue description
See title.
Steps to reproduce
Optionally download the MRP (rtl_jumps.zip) then go to step 9. Otherwise follow steps 2-8 to recreate the MRP.
Create a csv called
translations.csv
and add the following:key,en,ar test,test,test
Create a new project.
Click on
User Inteface
and replace the root node with aLineEdit
node.Move
translations.csv
created in step 2 into the new project.Project -> Project Settings...
Click on the
Localization
tab, clickAdd...
and choosetranslations.ar.translation
andtranslations.en.translation
.Click on the
General
tab, toggleAdvanced Settings
, Internationalization -> Locale, setTest
toar
.Run the project.
Paste this Arabic letter as the first letter:
ﺵ
Alternate between English letters and symbols, like
a,b<c>d;e:f
, and watch the cursor jump back and forth.https://github.com/godotengine/godot/assets/135338122/31032bb4-0e11-49dd-beca-7087bdc3a9bd
Notes
abc
then pasteﺵ
. Notice the cursor is to the left ofﺵ
. If you type another symbol or English letter the cursor will jump to the right. Again, I don't know if this is expected.Minimal reproduction project (MRP)
rtl_jumps.zip