Show in chats list EntityType::Pre like EntityType::Code.

This commit is contained in:
John Preston 2022-08-16 14:49:05 +03:00
parent 60cc232884
commit cece9cf09b

View file

@ -73,7 +73,7 @@ TextWithTagOffset<kTag> ReplaceTag<TextWithTagOffset<kTag>>::Call(
namespace Dialogs::Ui { namespace Dialogs::Ui {
TextWithEntities DialogsPreviewText(TextWithEntities text) { TextWithEntities DialogsPreviewText(TextWithEntities text) {
return Ui::Text::Filtered( auto result = Ui::Text::Filtered(
std::move(text), std::move(text),
{ {
EntityType::Pre, EntityType::Pre,
@ -85,6 +85,15 @@ TextWithEntities DialogsPreviewText(TextWithEntities text) {
EntityType::CustomEmoji, EntityType::CustomEmoji,
EntityType::PlainLink, EntityType::PlainLink,
}); });
for (auto &entity : result.entities) {
if (entity.type() == EntityType::Pre) {
entity = EntityInText(
EntityType::Code,
entity.offset(),
entity.length());
}
}
return result;
} }
struct MessageView::LoadingContext { struct MessageView::LoadingContext {