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
+15 -2
View File
@@ -374,6 +374,7 @@ BListView::MouseDown(BPoint point)
else else
Select(index); Select(index);
} }
fAnchorIndex = index;
} else { } else {
if (!(modifiers & B_COMMAND_KEY)) if (!(modifiers & B_COMMAND_KEY))
DeselectAll(); DeselectAll();
@@ -423,7 +424,13 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
&& (modifiers() & B_SHIFT_KEY) != 0) && (modifiers() & B_SHIFT_KEY) != 0)
extend = true; extend = true;
Select(fFirstSelected - 1, extend); if (fAnchorIndex > 0) {
if (fAnchorIndex <= fFirstSelected)
Select(fAnchorIndex - 1, extend);
else
Deselect(fAnchorIndex);
--fAnchorIndex;
}
} }
ScrollToSelection(); ScrollToSelection();
@@ -440,7 +447,13 @@ BListView::KeyDown(const char *bytes, int32 numBytes)
&& (modifiers() & B_SHIFT_KEY) != 0) && (modifiers() & B_SHIFT_KEY) != 0)
extend = true; extend = true;
Select(fLastSelected + 1, extend); if (fAnchorIndex < CountItems() - 1) {
if (fAnchorIndex >= fLastSelected)
Select(fAnchorIndex + 1, extend);
else
Deselect(fAnchorIndex);
++fAnchorIndex;
}
} }
ScrollToSelection(); ScrollToSelection();