Fix several instances of the anchor index not being properly tracked. When shift-selecting via keyboard, rely on the anchor to know where to shift the selection towards. Fixes rest of ticket #4120.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31890 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -374,6 +374,7 @@ BListView::MouseDown(BPoint point)
|
||||
else
|
||||
Select(index);
|
||||
}
|
||||
fAnchorIndex = index;
|
||||
} else {
|
||||
if (!(modifiers & B_COMMAND_KEY))
|
||||
DeselectAll();
|
||||
@@ -423,7 +424,13 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||
&& (modifiers() & B_SHIFT_KEY) != 0)
|
||||
extend = true;
|
||||
|
||||
Select(fFirstSelected - 1, extend);
|
||||
if (fAnchorIndex > 0) {
|
||||
if (fAnchorIndex <= fFirstSelected)
|
||||
Select(fAnchorIndex - 1, extend);
|
||||
else
|
||||
Deselect(fAnchorIndex);
|
||||
--fAnchorIndex;
|
||||
}
|
||||
}
|
||||
|
||||
ScrollToSelection();
|
||||
@@ -439,8 +446,14 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
|
||||
if (fListType == B_MULTIPLE_SELECTION_LIST
|
||||
&& (modifiers() & B_SHIFT_KEY) != 0)
|
||||
extend = true;
|
||||
|
||||
Select(fLastSelected + 1, extend);
|
||||
|
||||
if (fAnchorIndex < CountItems() - 1) {
|
||||
if (fAnchorIndex >= fLastSelected)
|
||||
Select(fAnchorIndex + 1, extend);
|
||||
else
|
||||
Deselect(fAnchorIndex);
|
||||
++fAnchorIndex;
|
||||
}
|
||||
}
|
||||
|
||||
ScrollToSelection();
|
||||
|
||||
Reference in New Issue
Block a user