Mixed Arabic + English: what each rule renders

Rendered by Chromium with the real bidi algorithm. Text samples, not a screenshot of the app UI.

Before — first strong character (dir="auto", unicode-bidi: plaintext)

Hello كيف حالك
Error: فشل الاتصال بالخادم
npm install ثم أعد التشغيل
@deepseek-ai/dsh مهم جدًا
The build failed while parsing سلام in the config file.

After — script dominance, one identifier = one word

Hello كيف حالك
Error: فشل الاتصال بالخادم
npm install ثم أعد التشغيل
@deepseek-ai/dsh مهم جدًا
The build failed while parsing سلام in the config file.
Every line starts with a Latin token, so the first-strong rule keeps an LTR paragraph base: the Arabic runs are laid out left-to-right and the sentence reads in the wrong order. Dominance counts words instead — @deepseek-ai/dsh is one word, a tie resolves to RTL, and a block with no Arabic word (last line) is left untouched.
Code blocks, paths and the composer are handled by the same layer and are not shown here.