Respected presence of plain link in preview text for mini icons.

This commit is contained in:
23rd 2023-09-03 17:20:13 +03:00 committed by John Preston
parent 9edbb9762a
commit 7740780eeb
2 changed files with 10 additions and 2 deletions

View File

@ -186,9 +186,12 @@ void MessageView::prepare(
_senderCache = { st::dialogsTextWidthMin };
}
TextUtilities::Trim(preview.text);
auto textToCache = DialogsPreviewText(std::move(preview.text));
_hasPlainLinkAtBegin = !textToCache.entities.empty()
&& (textToCache.entities.front().type() == EntityType::PlainLink);
_textCache.setMarkedText(
st::dialogsTextStyle,
DialogsPreviewText(std::move(preview.text)),
std::move(textToCache),
DialogTextOptions(),
context);
_textCachedFor = item;
@ -325,7 +328,11 @@ void MessageView::paint(
*_leftIcon,
context.active,
context.selected);
icon.paint(p, rect.topLeft(), rect.width());
if (_hasPlainLinkAtBegin && !context.active) {
icon.paint(p, rect.topLeft(), rect.width(), palette->linkFg->c);
} else {
icon.paint(p, rect.topLeft(), rect.width());
}
rect.setLeft(rect.x() + icon.width() + st::dialogsMiniIconSkip);
}
for (const auto &image : _imagesCache) {

View File

@ -94,6 +94,7 @@ private:
mutable std::unique_ptr<SpoilerAnimation> _spoiler;
mutable std::unique_ptr<LoadingContext> _loadingContext;
mutable const style::ThreeStateIcon *_leftIcon = nullptr;
mutable bool _hasPlainLinkAtBegin = false;
};