From bb7c4fbb2165dfe058f7dd7aac267e1f353ff614 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 4 Jan 2026 11:05:25 +0300 Subject: [PATCH] Fixed issue that caused peer list box height to fluctuate on show. Related commit: 64975f2dd5. --- Telegram/SourceFiles/boxes/peer_list_box.cpp | 14 ++++++++++---- Telegram/SourceFiles/boxes/peer_lists_box.cpp | 14 +++++++++----- Telegram/lib_ui | 2 +- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index be9431cdf8..ea3f726ad2 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -185,10 +185,7 @@ void PeerListBox::prepare() { object_ptr( this, _controller.get()), - st::boxScroll, - 0, - 0, - true /*alwaysKeepDimensionsToInner*/)); + st::boxScroll)); content()->resizeToWidth(_controller->contentWidth()); _controller->setDelegate(this); @@ -213,6 +210,15 @@ void PeerListBox::prepare() { if (_init) { _init(this); } + + { + setDimensions( + _controller->contentWidth(), + std::clamp( + content()->height(), + st::boxMaxListHeight, + st::boxMaxListHeight * 3)); + } } void PeerListBox::keyPressEvent(QKeyEvent *e) { diff --git a/Telegram/SourceFiles/boxes/peer_lists_box.cpp b/Telegram/SourceFiles/boxes/peer_lists_box.cpp index 1459351c15..4506075cec 100644 --- a/Telegram/SourceFiles/boxes/peer_lists_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_lists_box.cpp @@ -148,10 +148,7 @@ void PeerListsBox::updateScrollSkips() { void PeerListsBox::prepare() { auto rows = setInnerWidget( object_ptr(this), - st::boxScroll, - 0, - 0, - true /*alwaysKeepDimensionsToInner*/); + st::boxScroll); for (auto &list : _lists) { const auto content = rows->add(object_ptr( rows, @@ -181,7 +178,14 @@ void PeerListsBox::prepare() { } rows->resizeToWidth(firstController()->contentWidth()); - setDimensions(firstController()->contentWidth(), st::boxMaxListHeight); + { + setDimensions( + firstController()->contentWidth(), + std::clamp( + rows->height(), + st::boxMaxListHeight, + st::boxMaxListHeight * 3)); + } if (_select) { _select->finishAnimating(); Ui::SendPendingMoveResizeEvents(_select); diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 3faf86b9cf..7469948aeb 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 3faf86b9cf9befa9307bbb47833578a68ef18ea0 +Subproject commit 7469948aebd111e6543400feb9828bda984cc9fa