Skip to content

Support for Arabic Language and RTL Directionality #317

@iskepr

Description

@iskepr

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:

  1. Integrates textDirection support into the editor's styling.
  2. Fixes the horizontal scrolling and alignment for RTL lines.
  3. Ensures the gutter (line numbers) stays correctly positioned relative to the RTL text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions