listitemmanager: Fix section change handler mistake

The statement is not doing what it was meant to do.

gtk_list_item_manager_get_nth (self, position, &offset) returns the
tile for a given position, and if the tile maps to more than 1 item,
the offset indicates how far into that tile the given position is.

So position - offset would give us the position of this tile. It
doesn't make sense to subtract it from n_items.

Instead, we should be adding the offset to compensate for having
landed too early in the list, such that we successfully reach
position + n_items.
This commit is contained in:
António Fernandes
2024-01-25 17:18:05 +00:00
parent 3d88c44803
commit 9fb449793d

View File

@@ -1625,7 +1625,7 @@ gtk_list_item_manager_model_sections_changed_cb (GListModel *model,
gtk_list_item_change_clear_header (&change, &header->widget);
gtk_list_tile_set_type (header, GTK_LIST_TILE_UNMATCHED_HEADER);
n_items -= MIN (n_items, position - offset);
n_items += offset;
while (n_items > 0)
{
switch (tile->type)