Fixed two more peculiarities in ListView:

* when items are removed, the anchor may need adjustment (fixes the problem
  in Beam reported by Stippi)
* the check for needed adjustment of fLastSelected in _Select(from, to, extend)
  was broken, as it needs to be independent of fFirstSelected - this fixes
  broken navigation after doing a select-all

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32099 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe 2009-08-03 19:46:00 +00:00
parent 6a0a77e2fa
commit 44145c7405

View File

@ -671,6 +671,9 @@ BListView::RemoveItem(int32 index)
if (fLastSelected != -1 && index < fLastSelected)
fLastSelected--;
if (fAnchorIndex != -1 && index < fAnchorIndex)
fAnchorIndex--;
_RecalcItemTops(index);
_InvalidateFrom(index);
@ -696,6 +699,9 @@ BListView::RemoveItems(int32 index, int32 count)
if (index < 0)
return false;
if (fAnchorIndex != -1 && index < fAnchorIndex)
fAnchorIndex = index;
fList.RemoveItems(index, count);
if (index < fList.CountItems())
_RecalcItemTops(index);
@ -1479,10 +1485,12 @@ BListView::_Select(int32 from, int32 to, bool extend)
if (fFirstSelected == -1) {
fFirstSelected = from;
fLastSelected = to;
} else if (from < fFirstSelected)
fFirstSelected = from;
else if (to > fLastSelected)
fLastSelected = to;
} else {
if (from < fFirstSelected)
fFirstSelected = from;
if (to > fLastSelected)
fLastSelected = to;
}
for (int32 i = from; i <= to; ++i) {
BListItem *item = ItemAt(i);