BOutlineListView: fix keyboard navigation
* On left arrow key select parent item when selected item is collapsed. * Scroll to selected item when expanding/collapsing. Change-Id: Ia404abb970376d4168efd8bba4d8817712a885a6 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2873 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -199,8 +199,10 @@ BOutlineListView::KeyDown(const char* bytes, int32 numBytes)
|
||||
if (item && item->fHasSubitems) {
|
||||
if (!item->IsExpanded())
|
||||
Expand(item);
|
||||
else
|
||||
else {
|
||||
Select(currentSel + 1);
|
||||
ScrollToSelection();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -209,12 +211,14 @@ BOutlineListView::KeyDown(const char* bytes, int32 numBytes)
|
||||
{
|
||||
BListItem* item = ItemAt(currentSel);
|
||||
if (item) {
|
||||
if (item->fHasSubitems)
|
||||
if (item->fHasSubitems && item->IsExpanded())
|
||||
Collapse(item);
|
||||
else {
|
||||
item = Superitem(item);
|
||||
if (item)
|
||||
if (item) {
|
||||
Select(IndexOf(item));
|
||||
ScrollToSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user