small cleanup in ListView:
* avoid setting fAnchorIndex multiple times in certain situations git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32090 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
17a815e0ad
commit
9fe394010b
@ -424,7 +424,7 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||
} else {
|
||||
if (fAnchorIndex > 0) {
|
||||
if (!extend || fAnchorIndex <= fFirstSelected)
|
||||
Select(--fAnchorIndex, extend);
|
||||
Select(fAnchorIndex - 1, extend);
|
||||
else
|
||||
Deselect(fAnchorIndex--);
|
||||
}
|
||||
@ -441,7 +441,7 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||
} else {
|
||||
if (fAnchorIndex < CountItems() - 1) {
|
||||
if (!extend || fAnchorIndex >= fLastSelected)
|
||||
Select(++fAnchorIndex, extend);
|
||||
Select(fAnchorIndex + 1, extend);
|
||||
else
|
||||
Deselect(fAnchorIndex++);
|
||||
}
|
||||
@ -452,19 +452,19 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||
}
|
||||
|
||||
case B_HOME:
|
||||
if (extend)
|
||||
if (extend) {
|
||||
Select(0, fAnchorIndex, true);
|
||||
else
|
||||
Select(0, false);
|
||||
fAnchorIndex = 0;
|
||||
} else
|
||||
Select(0, false);
|
||||
ScrollToSelection();
|
||||
break;
|
||||
case B_END:
|
||||
if (extend)
|
||||
if (extend) {
|
||||
Select(fAnchorIndex, CountItems() - 1, true);
|
||||
else
|
||||
Select(CountItems() - 1, false);
|
||||
fAnchorIndex = CountItems() - 1;
|
||||
} else
|
||||
Select(CountItems() - 1, false);
|
||||
ScrollToSelection();
|
||||
break;
|
||||
|
||||
@ -1426,11 +1426,10 @@ BListView::_Select(int32 index, bool extend)
|
||||
|
||||
bool changed = false;
|
||||
|
||||
if (!extend) {
|
||||
fAnchorIndex = index;
|
||||
if (fFirstSelected != -1)
|
||||
if (!extend && fFirstSelected != -1)
|
||||
changed = _DeselectAll(index, index);
|
||||
}
|
||||
|
||||
fAnchorIndex = index;
|
||||
|
||||
BListItem* item = ItemAt(index);
|
||||
if (!item->IsEnabled() || item->IsSelected()) {
|
||||
|
Loading…
Reference in New Issue
Block a user