From da6956df3de863047cb96c21ee75982bf31f77dc Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 26 Mar 2026 13:29:59 +0300 Subject: [PATCH] [poll-view] Fixed vertical area for voted poll options without media. --- .../history/view/media/history_view_poll.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp index 16f28a758c..2a63a13cc8 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp @@ -554,15 +554,22 @@ QSize Poll::countOptimalSize() { + st::historyPollAnswerPadding.right()); } + const auto show = showVotes(); const auto answersHeight = ranges::accumulate(ranges::views::all( _answers - ) | ranges::views::transform([](const Answer &answer) { + ) | ranges::views::transform([show](const Answer &answer) { const auto media = answer.thumbnail ? PollAnswerMediaSize() : 0; const auto &padding = answer.thumbnail ? st::historyPollAnswerPadding : st::historyPollAnswerPaddingNoMedia; + const auto fillingWithChoice = show + ? (st::historyPollPercentFont->height + + st::historyPollFillingTop + + (st::historyPollFillingHeight + + st::historyPollChoiceRight.height()) / 2) + : 0; return padding.top() - + std::max(answer.text.minHeight(), media) + + std::max({ answer.text.minHeight(), media, fillingWithChoice }) + padding.bottom(); }), 0); @@ -704,8 +711,18 @@ int Poll::countAnswerHeight( const auto &padding = answer.thumbnail ? st::historyPollAnswerPadding : st::historyPollAnswerPaddingNoMedia; + const auto fillingWithChoice = showVotes() + ? (st::historyPollPercentFont->height + + st::historyPollFillingTop + + (st::historyPollFillingHeight + + st::historyPollChoiceRight.height()) / 2) + : 0; return padding.top() - + std::max(answer.text.countHeight(textWidth), media) + + std::max({ + answer.text.countHeight(textWidth), + media, + fillingWithChoice, + }) + padding.bottom(); }