From 2f3e1117f9fe7d22126aebe91cb8da6e7fea8e0a Mon Sep 17 00:00:00 2001 From: Sean Healy Date: Sun, 14 Jan 2018 12:45:27 +0100 Subject: [PATCH] BOutlineListView::EachItemUnder gets too many items EachItemUnder selects items that are not in fact under the superitem passed to the method. ticket: #13730 Change-Id: I12a2e29204e1b9bbecd5704e60a02e3613a7f4fd Reviewed-on: https://review.haiku-os.org/52 Reviewed-by: waddlesplash --- src/kits/interface/OutlineListView.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/OutlineListView.cpp b/src/kits/interface/OutlineListView.cpp index 3220cfc4cd..0186c8e686 100644 --- a/src/kits/interface/OutlineListView.cpp +++ b/src/kits/interface/OutlineListView.cpp @@ -721,15 +721,16 @@ BListItem* BOutlineListView::EachItemUnder(BListItem* superItem, bool oneLevelOnly, BListItem* (*eachFunc)(BListItem* item, void* arg), void* arg) { - int32 i = IndexOf(superItem); + int32 i = FullListIndexOf(superItem); if (i == -1) return NULL; + i++; // skip the superitem while (i < FullListCountItems()) { BListItem* item = FullListItemAt(i); // If we jump out of the subtree, return NULL - if (item->fLevel < superItem->OutlineLevel()) + if (item->fLevel <= superItem->OutlineLevel()) return NULL; // If the level matches, check the index