You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Skia] CR and LF in different inlines make one line break; WinUI makes two #26148
On Skia, a TextBlock with a carriage return (U+000D) at the end of one inline and a line feed (U+000A) at the start of the next breaks the line once. WinUI breaks it twice. A LineBreak element counts as a line feed in the same way.
Inlines
WinUI (Windows App SDK 1.8)
Uno master (Skia desktop)
Run("a\r") + LineBreak + Run("b")
3 lines
2 lines
Run("a\r") + Run("\nb")
3 lines
2 lines
Both agree when the CR and LF are in the same Run (Run("a\r\nb") and Run("a") + Run("\r\nb") give 2 lines), and when the two breaks aren't a CR followed by an LF (Run("a\n") + LineBreak + Run("b") gives 3 lines).
The WinUI numbers are line counts from ActualHeight and the position of b, for a TextBlock with no wrapping.
Expected behavior
The same line count as WinUI: a CR that ends one inline and an LF that starts the next are two line breaks.
Cause
UnicodeText computes line-break opportunities over the whole text, since #23924. ICU treats CR LF as a single break wherever the two characters come from, so the pair merges across the inline boundary. The comment there says the merge is intended:
Line breaking is a document-level operation. Computing boundaries per inline can split a CRLF pair when character formatting changes between its two code units.
That reads as a RichEditBox concern, where a CRLF pair can straddle a formatting change. For TextBlock, WinUI keeps the inline boundary between the two breaks.
Question
Should TextBlock match WinUI here, for example by keeping a mandatory break at an inline boundary where one inline ends with CR and the next starts with LF, while RichEditBox keeps the pair together?
Activity