Fix deleting a search result in chats list.

This commit is contained in:
John Preston 2022-12-16 20:16:44 +04:00
parent af350e2daa
commit 5ebea97ded

View File

@ -1774,18 +1774,24 @@ void InnerWidget::moveCancelSearchButtons() {
void InnerWidget::dialogRowReplaced(
Row *oldRow,
Row *newRow) {
auto found = false;
if (_state == WidgetState::Filtered) {
auto top = 0;
for (auto i = _filterResults.begin(); i != _filterResults.end();) {
if (i->row == oldRow) { // this row is shown in filtered and maybe is in contacts!
if (newRow) {
i->row = newRow;
++i;
} else {
found = true;
top = i->top;
if (!newRow) {
i = _filterResults.erase(i);
continue;
}
} else {
++i;
i->row = newRow;
}
if (found) {
i->top = top;
top += i->row->height();
}
++i;
}
}
if (_selected == oldRow) {
@ -1801,6 +1807,9 @@ void InnerWidget::dialogRowReplaced(
stopReorderPinned();
}
}
if (found) {
refresh();
}
}
void InnerWidget::handleChatListEntryRefreshes() {