From 40e5560a3ce096847177090e3430bb8a55b64f4d Mon Sep 17 00:00:00 2001 From: Freaxed Date: Thu, 23 Mar 2023 14:14:21 +0100 Subject: [PATCH] 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 Tested-by: Automation Reviewed-by: Stefano Ceccherini Reviewed-by: Adrien Destugues --- src/kits/interface/OutlineListView.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/OutlineListView.cpp b/src/kits/interface/OutlineListView.cpp index 483eac2f87..89b8d6b183 100644 --- a/src/kits/interface/OutlineListView.cpp +++ b/src/kits/interface/OutlineListView.cpp @@ -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++; }