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
|
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();
|
||||||
|
|||||||
Reference in New Issue
Block a user