BOutlineListView: fixed expansion causing items to disappear

On a multi-level list view, when expanding an item containing other collapsed lists, the last items disappear due to a wrong element counting.

Change-Id: I2313ad8efb23e8db54cd3563687bf0c2a775a12a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6259
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Stefano Ceccherini <stefano.ceccherini@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit is contained in:
Freaxed 2023-03-23 14:14:21 +01:00 committed by waddlesplash
parent 8079adc050
commit 40e5560a3c

View File

@ -846,8 +846,10 @@ BOutlineListView::ExpandOrCollapse(BListItem* item, bool expand)
uint32 subLevel = item->fLevel;
items++;
while (--count > 0 && items[0]->fLevel > subLevel)
while (count > 0 && items[0]->fLevel > subLevel) {
items++;
count--;
}
} else
items++;
}