[thanos] Tracked original gap height to fix post-deletion gap positions.

This commit is contained in:
23rd
2026-04-09 23:14:54 +03:00
parent 64a23b38db
commit ccc91b1e00
2 changed files with 10 additions and 1 deletions
@@ -7588,6 +7588,7 @@ void HistoryWidget::startCollapseAnimation(int height, int itemTop) {
&& itemTop <= gap.absY + gap.currentHeight)) {
gap.startHeight += height;
gap.currentHeight += height;
gap.originalHeight += height;
merged = true;
break;
}
@@ -7595,6 +7596,7 @@ void HistoryWidget::startCollapseAnimation(int height, int itemTop) {
gap.absY = itemTop;
gap.startHeight += height;
gap.currentHeight += height;
gap.originalHeight += height;
merged = true;
break;
}
@@ -7604,6 +7606,7 @@ void HistoryWidget::startCollapseAnimation(int height, int itemTop) {
.absY = itemTop,
.startHeight = height,
.currentHeight = height,
.originalHeight = height,
});
std::sort(_collapseGaps.begin(), _collapseGaps.end(),
[](const auto &a, const auto &b) { return a.absY < b.absY; });
@@ -7660,8 +7663,13 @@ void HistoryWidget::syncCollapseGapsToList() {
}
auto gaps = std::vector<HistoryInner::CollapseGap>();
gaps.reserve(_collapseGaps.size());
auto cumulativeOriginal = 0;
for (const auto &g : _collapseGaps) {
gaps.push_back({ .absY = g.absY, .height = g.currentHeight });
gaps.push_back({
.absY = g.absY - cumulativeOriginal,
.height = g.currentHeight,
});
cumulativeOriginal += g.originalHeight;
}
_list->setCollapseGaps(gaps);
}
@@ -949,6 +949,7 @@ private:
int absY = -1;
int startHeight = 0;
int currentHeight = 0;
int originalHeight = 0;
};
std::vector<CollapseGapState> _collapseGaps;
Ui::Animations::Simple _collapseAnimation;