Wrap names in LRM/RLM for correct layout.

This commit is contained in:
John Preston 2024-08-21 12:04:51 +02:00
parent 675198d361
commit 24b0b33f1d
4 changed files with 12 additions and 9 deletions

View file

@ -165,11 +165,12 @@ TextWithEntities ForumTopicIconWithTitle(
MsgId rootId, MsgId rootId,
DocumentId iconId, DocumentId iconId,
const QString &title) { const QString &title) {
const auto wrapped = st::wrap_rtl(title);
return (rootId == ForumTopic::kGeneralId) return (rootId == ForumTopic::kGeneralId)
? TextWithEntities{ u"# "_q + title } ? TextWithEntities{ u"# "_q + wrapped }
: iconId : iconId
? Data::SingleCustomEmoji(iconId).append(' ').append(title) ? Data::SingleCustomEmoji(iconId).append(' ').append(wrapped)
: TextWithEntities{ title }; : TextWithEntities{ wrapped };
} }
QString ForumGeneralIconTitle() { QString ForumGeneralIconTitle() {

View file

@ -445,12 +445,13 @@ HistoryView::ItemPreview PreviewWithSender(
HistoryView::ItemPreview &&preview, HistoryView::ItemPreview &&preview,
const QString &sender, const QString &sender,
TextWithEntities topic) { TextWithEntities topic) {
const auto wrappedSender = st::wrap_rtl(sender);
auto senderWithOffset = topic.empty() auto senderWithOffset = topic.empty()
? TextWithTagOffset<lt_from>::FromString(sender) ? TextWithTagOffset<lt_from>::FromString(wrappedSender)
: tr::lng_dialogs_text_from_in_topic( : tr::lng_dialogs_text_from_in_topic(
tr::now, tr::now,
lt_from, lt_from,
{ sender }, { wrappedSender },
lt_topic, lt_topic,
std::move(topic), std::move(topic),
TextWithTagOffset<lt_from>::FromString); TextWithTagOffset<lt_from>::FromString);

View file

@ -847,7 +847,7 @@ void MainWindow::updateTitle() {
const auto user = (session const auto user = (session
&& !settings.hideAccountName && !settings.hideAccountName
&& Core::App().domain().accountsAuthedCount() > 1) && Core::App().domain().accountsAuthedCount() > 1)
? session->authedName() ? st::wrap_rtl(session->authedName())
: QString(); : QString();
const auto key = (session && !settings.hideChatName) const auto key = (session && !settings.hideChatName)
? session->activeChatCurrent() ? session->activeChatCurrent()
@ -864,10 +864,11 @@ void MainWindow::updateTitle() {
: history->peer->isSelf() : history->peer->isSelf()
? tr::lng_saved_messages(tr::now) ? tr::lng_saved_messages(tr::now)
: history->peer->name(); : history->peer->name();
const auto wrapped = st::wrap_rtl(name);
const auto threadCounter = thread->chatListBadgesState().unreadCounter; const auto threadCounter = thread->chatListBadgesState().unreadCounter;
const auto primary = (threadCounter > 0) const auto primary = (threadCounter > 0)
? u"(%1) %2"_q.arg(threadCounter).arg(name) ? u"(%1) %2"_q.arg(threadCounter).arg(wrapped)
: name; : wrapped;
const auto middle = !user.isEmpty() const auto middle = !user.isEmpty()
? (u" @ "_q + user) ? (u" @ "_q + user)
: !added.isEmpty() : !added.isEmpty()

View file

@ -971,7 +971,7 @@ void Notification::updateNotifyDisplay() {
} }
const auto topicWithChat = [&]() -> TextWithEntities { const auto topicWithChat = [&]() -> TextWithEntities {
const auto name = _history->peer->name(); const auto name = st::wrap_rtl(_history->peer->name());
return _topic return _topic
? _topic->titleWithIcon().append(u" ("_q + name + ')') ? _topic->titleWithIcon().append(u" ("_q + name + ')')
: TextWithEntities{ name }; : TextWithEntities{ name };