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,
DocumentId iconId,
const QString &title) {
const auto wrapped = st::wrap_rtl(title);
return (rootId == ForumTopic::kGeneralId)
? TextWithEntities{ u"# "_q + title }
? TextWithEntities{ u"# "_q + wrapped }
: iconId
? Data::SingleCustomEmoji(iconId).append(' ').append(title)
: TextWithEntities{ title };
? Data::SingleCustomEmoji(iconId).append(' ').append(wrapped)
: TextWithEntities{ wrapped };
}
QString ForumGeneralIconTitle() {

View file

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

View file

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

View file

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