Perform bidirectionality isolation manually instead of relying on BidiFormatter (#1976)

* Perform manual isolation of display names etc. instead of relying on BidiFormatter.
Fixes #1921

* Make follow request notification header formatting more like other notifications
This commit is contained in:
Levi Bard 2020-11-04 18:21:41 +01:00 committed by GitHub
commit 2170e6b0fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 34 deletions

View file

@ -80,3 +80,12 @@ fun Spanned.trimTrailingWhitespace(): Spanned {
} while (i >= 0 && get(i).isWhitespace())
return subSequence(0, i + 1) as Spanned
}
/**
* BidiFormatter.unicodeWrap is insufficient in some cases (see #1921)
* So we force isolation manually
* https://unicode.org/reports/tr9/#Explicit_Directional_Isolates
*/
fun CharSequence.unicodeWrap(): String {
return "\u2068${this}\u2069"
}