diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index 67bf9c1723..45c1f4b7cb 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -153,6 +153,7 @@ void HistoryMessageVia::resize(int32 availw) const { tr::now, lt_inline_bot, '@' + bot->username()); + maxWidth = st::msgServiceNameFont->width(text); if (availw < maxWidth) { text = st::msgServiceNameFont->elided(text, availw); width = st::msgServiceNameFont->width(text); diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 7823de3d72..8530ea61f1 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1865,7 +1865,6 @@ void Message::paintFromName( } else { st::dialogsPremiumIcon.icon.paint(p, x, y, width(), color); } - availableWidth -= statusWidth; } p.setFont(st::msgNameFont); p.setPen(nameFg); @@ -3297,7 +3296,6 @@ bool Message::getStateFromName( outResult->link = _fromNameStatus->link; return true; } - availableWidth -= statusWidth; } if (point.x() >= availableLeft && point.x() < availableLeft + availableWidth @@ -3307,12 +3305,22 @@ bool Message::getStateFromName( _fromLinkRipplePointSet = 1; return true; } + + const auto skipWidth = nameText->maxWidth() + + (_fromNameStatus + ? (st::dialogsPremiumIcon.icon.width() + + st::msgServiceFont->spacew) + : 0) + + st::msgServiceFont->spacew; + availableLeft += skipWidth; + availableWidth -= skipWidth; + auto via = item->Get(); if (via && !displayForwardedFrom() - && point.x() >= availableLeft + nameText->maxWidth() + st::msgServiceFont->spacew + && point.x() >= availableLeft && point.x() < availableLeft + availableWidth - && point.x() < availableLeft + nameText->maxWidth() + st::msgServiceFont->spacew + via->width) { + && point.x() < availableLeft + via->width) { outResult->link = via->link; recordLinkRipplePoint(point, trect.topLeft()); return true;