Currently, the flutter_code_editor does not properly handle Right-to-Left (RTL) languages, specifically Arabic. This causes several UI and UX issues when writing or displaying Arabic code comments, strings, or documentation within the editor.
Current Behavior
- Text alignment defaults to Left-to-Right (LTR) even when the system locale or specific text is Arabic.
- Cursors and selection highlights might behave unpredictably in RTL contexts.
- Punctuation and mixed LTR/RTL text (BiDi) are rendered incorrectly, breaking the code's visual structure.
Expected Behavior
- The editor should detect or allow setting the
textDirection to TextDirection.rtl.
- Proper cursor placement and movement logic for RTL text.
- Support for Arabic characters without overlapping or rendering issues in the code lines.
Proposed Solution (I can contribute this!)
I have investigated the rendering logic and the CodeField implementation. I plan to submit a PR that:
- Integrates
textDirection support into the editor's styling.
- Fixes the horizontal scrolling and alignment for RTL lines.
- Ensures the gutter (line numbers) stays correctly positioned relative to the RTL text.
Currently, the
flutter_code_editordoes not properly handle Right-to-Left (RTL) languages, specifically Arabic. This causes several UI and UX issues when writing or displaying Arabic code comments, strings, or documentation within the editor.Current Behavior
Expected Behavior
textDirectiontoTextDirection.rtl.Proposed Solution (I can contribute this!)
I have investigated the rendering logic and the
CodeFieldimplementation. I plan to submit a PR that:textDirectionsupport into the editor's styling.