Fix elision of localized Verification Codes name.

This commit is contained in:
John Preston 2025-01-09 21:24:14 +04:00
parent a1aa315187
commit 199e7a1d46

View file

@ -705,11 +705,11 @@ void PaintRow(
}
p.setFont(st::semiboldFont);
const auto paintPeerBadge = [&] {
const auto paintPeerBadge = [&](int rowNameWidth) {
const auto badgeWidth = rowBadge.drawGetWidth(p, {
.peer = from,
.rectForName = rectForName,
.nameWidth = rowName.maxWidth(),
.nameWidth = rowNameWidth,
.outerWidth = context.width,
.verified = (context.active
? &st::dialogsVerifiedIconActive
@ -742,9 +742,6 @@ void PaintRow(
| Flag::VerifyCodes
| Flag::HiddenAuthor
| Flag::MyNotes)) {
if (!context.search && (flags & Flag::VerifyCodes)) {
paintPeerBadge();
}
auto text = (flags & Flag::SavedMessages)
? tr::lng_saved_messages(tr::now)
: (flags & Flag::RepliesMessages)
@ -755,6 +752,9 @@ void PaintRow(
? tr::lng_my_notes(tr::now)
: tr::lng_hidden_author_messages(tr::now);
const auto textWidth = st::semiboldFont->width(text);
if (!context.search && (flags & Flag::VerifyCodes)) {
paintPeerBadge(textWidth);
}
if (textWidth > rectForName.width()) {
text = st::semiboldFont->elided(text, rectForName.width());
}
@ -770,7 +770,7 @@ void PaintRow(
text);
} else if (from) {
if ((history || sublist) && !context.search) {
paintPeerBadge();
paintPeerBadge(rowName.maxWidth());
}
p.setPen(context.active
? st::dialogsNameFgActive