From f8c631ed24d80ff82fbf159c9f79ad8ab9dbb6fd Mon Sep 17 00:00:00 2001 From: Beni Cherniavsky-Paskin Date: Fri, 3 Sep 2021 14:31:18 +0300 Subject: [PATCH] Export CSS: per-line automatic bidi direction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #16120. `unicode-bidi: plaintext` makes browser auto-detect base bidi direction according to bidi algorithm heuristics, on each line separately. https://drafts.csswg.org/css-writing-modes/#bidi-algo AFAICT this matches both Android and Desktop behaviors, and is the friendly behavior for mixed-direction users. Purely LTR users should not be affected — the heuristics return LTR even on "neutral" lines that contain no letters, only punctuation/emojis/digits. (http://www.unicode.org/reports/tr9/#P2 — rule P3 defaults to level 0, which is LTR.) Whereas all RTL language users in practice need to deal with mixed-direction texts, and the ability to split lines to prevent LTR/RTL mixups is extremely handy... The `text-align: start` ensures LTR-detected lines are displayed left-aligned, and RTL-detected lines right-aligned. Which again matches both Android and Desktop behaviors. This is redundant — it seems already the default with current CSS — but is important for mixed-language users, so I wanted to ensure it in case somebody sets alignment on bigger parts of the document in the future. --- Telegram/Resources/export_html/css/style.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Telegram/Resources/export_html/css/style.css b/Telegram/Resources/export_html/css/style.css index 52b90fd05..8493418e7 100644 --- a/Telegram/Resources/export_html/css/style.css +++ b/Telegram/Resources/export_html/css/style.css @@ -291,6 +291,8 @@ div.selected { .default .text { word-wrap: break-word; line-height: 150%; + unicode-bidi: plaintext; + text-align: start; } .default .reply_to, .default .media_wrap {