Run the attached program on macOS (first reproduced on M1 Pro 14.5).
- slowly make the frame width larger by dragging the right edge of the window to the right
observe the following failure modes:
1. a space appears between "::" and "Arabic" on the first line
2. when this happens, the cursor stops blinking (either stays on or disappears)
3. when the Arabic word appears on the first line, the space between "::" and "Arabic" disappears (the text gets rendered correctly) but the part of the cursor's direction indicator sometimes remains on screen permanently
(see the screenshots)
This issue is similar to https://bugs.openjdk.org/browse/JDK-8330559 in JavaFX, or it might be caused by the same macOS bug.
The phantom space seems to appears when the CTRunGetPositions native call populates the positions array with negative values.
For reference, the text string is
"Arabic:: " +
"\u0627\u0644\u0639\u0631\u0628\u064a\u0629" +
"\n" +
"Hebrew: " +
"\u05e2\u05d1\u05e8\u05d9\u05ea"
Apple API https://developer.apple.com/documentation/coretext/1508678-ctrungetpositions