Skip to content

Text: mixed-direction text reads correctly in static texts, Markdown, fields and fonts - #725

Merged
Hona merged 1 commit into
devfrom
bidi-isolates
Nov 12, 2026
Merged

Hona merged 1 commit into
devfrom
bidi-isolates

Conversation

@Hona

@Hona Hona commented Nov 12, 2026

Copy link
Copy Markdown
Member

Mixed-direction text in Rune, measured against UAX #9 and the design in notes/bidi-design.md (not against OpenCode Desktop, whose bidi the owner called not great).

  • Isolates for static text. El::isolate(range, dir) writes LRI, RLI or FSI .. PDI around a run of a static text's content, moves every range onto the marked text, and marks the marks uncopied, so copies stay clean. rune::text::ltr_units finds the runs prose needs isolated: paths, URLs, fn() calls, --flags, file names, #123, +12 and v2.14.0. Static pills become Auto isolates, as field pills already are.
  • Kit Markdown direction. Each paragraph and heading takes its own first strong character outside code and URLs. Lists take one direction each, so their markers stay on one rail. Quotes and tables take their content's direction, and table cells keep their column's alignment. Code and diffs are always left to right. Neutral blocks follow the block before. Markdown::dir_tentative holds a streaming reply's direction until its first words arrive.
  • Neutral text follows its context.
    • dir(Auto) with no strong character takes the parent's flow.
    • In by-paragraph text, a neutral line takes the line before it, and the first lines take the element's flow.
    • Empty right-to-left lines put the caret at the right.
    • Left and Right collapse a selection to the end drawn that way.
    • truncate_fade fades the end of the text's own paragraph.
  • Fonts.
    • The Arabic comma, semicolon and question mark no longer draw as tofu after Latin text.
    • On Windows, script fallbacks load the whole family, so 530 and 600+ weights get real Semibold and Bold.
    • The mono stack gains monospace Arabic and Hebrew faces: Courier New (0.6 em, like IBM Plex Mono) and DejaVu Sans Mono.
  • UAX Fit images to their aspect ratio; app icons on Windows and Linux #9 conformance. vendor/parley_engine adds rule L1 at the paragraph's end. Unicode 17 BidiTest.txt now passes 770,241 of 770,241 (644,283 before), and BidiCharacterTest.txt 91,707 of 91,707. The harness lives outside the repo.
  • Checks. check --workspace --all-targets passes.

… fields and fonts

- El::isolate and rune::text::ltr_units: runs that keep their own order (paths, URLs, calls,
  flags, file names, references, signed numbers); static pills are Auto isolates.
- Kit Markdown: per-block direction (paragraphs, headings, one per list, quotes, tables), code
  and diffs left to right, neutral blocks follow the block before, Markdown::dir_tentative.
- dir(Auto) with no strong character takes its parent's direction; by-paragraph lines with none
  follow the line before; an empty right-to-left line's caret at its right; Left/Right collapse
  a selection to the end drawn that way; truncate_fade fades the text's own end.
- Fonts: Arabic comma after Latin no longer tofu; Windows script fallbacks load whole families;
  monospace Arabic and Hebrew (Courier New, DejaVu Sans Mono) in code.
- vendor/parley_engine: UAX #9 L1 at a paragraph's end; BidiTest.txt 770,241/770,241.
Copilot AI balanced review requested due to automatic review settings November 12, 2026 05:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Hona
Hona merged commit aa01f28 into dev Nov 12, 2026
1 check passed
@Hona
Hona deleted the bidi-isolates branch November 12, 2026 05:42
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.

2 participants