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:
parent
6a0a77e2fa
commit
44145c7405
@ -671,6 +671,9 @@ BListView::RemoveItem(int32 index)
|
|||||||
if (fLastSelected != -1 && index < fLastSelected)
|
if (fLastSelected != -1 && index < fLastSelected)
|
||||||
fLastSelected--;
|
fLastSelected--;
|
||||||
|
|
||||||
|
if (fAnchorIndex != -1 && index < fAnchorIndex)
|
||||||
|
fAnchorIndex--;
|
||||||
|
|
||||||
_RecalcItemTops(index);
|
_RecalcItemTops(index);
|
||||||
|
|
||||||
_InvalidateFrom(index);
|
_InvalidateFrom(index);
|
||||||
@ -696,6 +699,9 @@ BListView::RemoveItems(int32 index, int32 count)
|
|||||||
if (index < 0)
|
if (index < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (fAnchorIndex != -1 && index < fAnchorIndex)
|
||||||
|
fAnchorIndex = index;
|
||||||
|
|
||||||
fList.RemoveItems(index, count);
|
fList.RemoveItems(index, count);
|
||||||
if (index < fList.CountItems())
|
if (index < fList.CountItems())
|
||||||
_RecalcItemTops(index);
|
_RecalcItemTops(index);
|
||||||
@ -1479,10 +1485,12 @@ BListView::_Select(int32 from, int32 to, bool extend)
|
|||||||
if (fFirstSelected == -1) {
|
if (fFirstSelected == -1) {
|
||||||
fFirstSelected = from;
|
fFirstSelected = from;
|
||||||
fLastSelected = to;
|
fLastSelected = to;
|
||||||
} else if (from < fFirstSelected)
|
} else {
|
||||||
fFirstSelected = from;
|
if (from < fFirstSelected)
|
||||||
else if (to > fLastSelected)
|
fFirstSelected = from;
|
||||||
fLastSelected = to;
|
if (to > fLastSelected)
|
||||||
|
fLastSelected = to;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32 i = from; i <= to; ++i) {
|
for (int32 i = from; i <= to; ++i) {
|
||||||
BListItem *item = ItemAt(i);
|
BListItem *item = ItemAt(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user