2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 15:05:56 +00:00

Update dialog row height on topic switch.

This commit is contained in:
John Preston
2022-11-29 21:36:34 +04:00
parent 3c799a5cc1
commit beaea9c57d
14 changed files with 80 additions and 2 deletions

View File

@@ -285,8 +285,14 @@ InnerWidget::InnerWidget(
session().changes().entryUpdates(
Data::EntryUpdate::Flag::Repaint
| Data::EntryUpdate::Flag::Height
) | rpl::start_with_next([=](const Data::EntryUpdate &update) {
const auto entry = update.entry;
if (update.flags & Data::EntryUpdate::Flag::Height) {
updateFilteredEntryHeight(entry);
refresh();
return;
}
const auto repaintId = (_state == WidgetState::Default)
? _filterId
: 0;
@@ -320,6 +326,24 @@ InnerWidget::InnerWidget(
setupShortcuts();
}
void InnerWidget::updateFilteredEntryHeight(not_null<Entry*> entry) {
auto changing = false;
auto top = 0;
for (auto &result : _filterResults) {
if (changing) {
result.top = top;
}
if (result.row->key().entry() == entry) {
result.row->recountHeight();
changing = true;
top = result.top;
}
if (changing) {
top += result.row->height();
}
}
}
Main::Session &InnerWidget::session() const {
return _controller->session();
}