Skip to content

Fix bidi explicit formatting after reset - #22288

Merged
Gillibald merged 5 commits into
AvaloniaUI:mainfrom
George-Payne:fix-bidi-explicit-formatting-after-reset
Oct 5, 2026
Merged

Gillibald merged 5 commits into
AvaloniaUI:mainfrom
George-Payne:fix-bidi-explicit-formatting-after-reset

Conversation

@George-Payne

Copy link
Copy Markdown
Contributor

What does the pull request do?

Fixes explicit bidi formatting characters being ignored in every paragraph after the first formatted on a thread.

What is the current behavior?

The first paragraph formatted on a thread resolves them correctly, but every paragraph after it lays out as if they weren't there.

Override: the text should be forced to display right to left.

Order <RLO>abc-123<PDF> shipped

Expected:  Order 321-cba shipped
Actual:    Order abc-123 shipped

Isolate: The isolate should stop the name from pulling the number that follows it into its right-to-left run.

<RLI>محمد<PDI> - 3 reviews

Expected:  محمد‎ - 3 reviews
Actual:    محمد - 3 reviews

What is the updated/expected behavior with this PR?

Explicit formatting characters now apply correctly after a reset.

How was the solution implemented (if it's not obvious)?

HasEmbeddings and HasIsolates are now allowed to be set even if they are set to false by a reset (matching HasBrackets).

Checklist

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

NuGet packages

The packages for this pull request have been published (workflow run):

@MrJul MrJul added bug area-textprocessing backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Sep 23, 2026
Append only set HasEmbeddings and HasIsolates if they had no value, but Reset
sets them to false. Once a BidiData had been reset, explicit formatting
characters could no longer raise them, so overrides, embeddings and isolates
were only applied only applied in the first paragraph formatted on a thread.

HasBrackets is reset the same way, this makes the flags match.
@George-Payne
George-Payne force-pushed the fix-bidi-explicit-formatting-after-reset branch from 99eb6a0 to 95c052f Compare September 30, 2026 11:16

@Gillibald Gillibald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for this contribution

@Gillibald
Gillibald enabled auto-merge October 5, 2026 08:57
@Gillibald
Gillibald added this pull request to the merge queue Oct 5, 2026
Merged via the queue into AvaloniaUI:main with commit be9b480 Oct 5, 2026
16 of 17 checks passed
grokys pushed a commit to Evan260/Avalonia that referenced this pull request Oct 7, 2026
* Add failing tests for bidi controls being ignored after the first paragraph

* Allow embedding and isolate flags to be set after a reset

Append only set HasEmbeddings and HasIsolates if they had no value, but Reset
sets them to false. Once a BidiData had been reset, explicit formatting
characters could no longer raise them, so overrides, embeddings and isolates
were only applied only applied in the first paragraph formatted on a thread.

HasBrackets is reset the same way, this makes the flags match.

* Escape bidi control characters in tests

---------

Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
MrJul pushed a commit that referenced this pull request Oct 9, 2026
* Add failing tests for bidi controls being ignored after the first paragraph

* Allow embedding and isolate flags to be set after a reset

Append only set HasEmbeddings and HasIsolates if they had no value, but Reset
sets them to false. Once a BidiData had been reset, explicit formatting
characters could no longer raise them, so overrides, embeddings and isolates
were only applied only applied in the first paragraph formatted on a thread.

HasBrackets is reset the same way, this makes the flags match.

* Escape bidi control characters in tests

---------

Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants