From 7c6bb132ce7d1298391cc87c5a3a071e8222b407 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 18 Jul 2017 19:47:56 +0300 Subject: [PATCH] Don't display reply preview if it doesn't fit. --- Telegram/SourceFiles/history/history_message.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 726d49c59..751a71044 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -495,8 +495,11 @@ void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, in if (w > st::msgReplyBarSkip) { if (replyToMsg) { - bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; - int previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; + auto hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; + if (hasPreview && w < st::msgReplyBarSkip + st::msgReplyBarSize.height()) { + hasPreview = false; + } + auto previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; if (hasPreview) { ImagePtr replyPreview = replyToMsg->getMedia()->replyPreview();