Use Ui::Text::String to show topic names.

Fixes #27956.
This commit is contained in:
John Preston 2024-05-31 09:08:30 +04:00
parent 27eb3e45be
commit 5cfd86b829
1 changed files with 6 additions and 11 deletions

View File

@ -259,9 +259,9 @@ void PaintRow(
not_null<Entry*> entry, not_null<Entry*> entry,
VideoUserpic *videoUserpic, VideoUserpic *videoUserpic,
PeerData *from, PeerData *from,
PeerBadge &fromBadge, PeerBadge &rowBadge,
Fn<void()> customEmojiRepaint, Fn<void()> customEmojiRepaint,
const Text::String &fromName, const Text::String &rowName,
const HiddenSenderInfo *hiddenSenderInfo, const HiddenSenderInfo *hiddenSenderInfo,
HistoryItem *item, HistoryItem *item,
const Data::Draft *draft, const Data::Draft *draft,
@ -626,10 +626,10 @@ void PaintRow(
p.drawTextLeft(rectForName.left(), rectForName.top(), context.width, text); p.drawTextLeft(rectForName.left(), rectForName.top(), context.width, text);
} else if (from) { } else if (from) {
if ((history || sublist) && !context.search) { if ((history || sublist) && !context.search) {
const auto badgeWidth = fromBadge.drawGetWidth( const auto badgeWidth = rowBadge.drawGetWidth(
p, p,
rectForName, rectForName,
fromName.maxWidth(), rowName.maxWidth(),
context.width, context.width,
{ {
.peer = from, .peer = from,
@ -663,7 +663,7 @@ void PaintRow(
: context.selected : context.selected
? st::dialogsNameFgOver ? st::dialogsNameFgOver
: st::dialogsNameFg); : st::dialogsNameFg);
fromName.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); rowName.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
} else if (hiddenSenderInfo) { } else if (hiddenSenderInfo) {
p.setPen(context.active p.setPen(context.active
? st::dialogsNameFgActive ? st::dialogsNameFgActive
@ -681,12 +681,7 @@ void PaintRow(
: (context.selected : (context.selected
? st::dialogsNameFgOver ? st::dialogsNameFgOver
: st::dialogsNameFg)); : st::dialogsNameFg));
auto text = entry->chatListName(); // TODO feed name with emoji rowName.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
auto textWidth = st::semiboldFont->width(text);
if (textWidth > rectForName.width()) {
text = st::semiboldFont->elided(text, rectForName.width());
}
p.drawTextLeft(rectForName.left(), rectForName.top(), context.width, text);
} }
} }