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:
Rene Gollent
2009-07-29 01:59:58 +00:00
parent e80a60b54f
commit 7155254d3f
+16 -3
View File
@@ -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();