ColumnListView: deselect the last selected row
when the shift movement goes back. This behavior feels better to me, but opinions are welcome. Tested with HaikuDepot package listview. Noticed that CLV uses Ctrl whereas Tracker uses Alt for single item selection.
This commit is contained in:
parent
f3e381dd0c
commit
073da30265
@ -4008,6 +4008,7 @@ OutlineView::ChangeFocusRow(bool up, bool updateSelection,
|
|||||||
fFocusRowRect.right = 10000;
|
fFocusRowRect.right = 10000;
|
||||||
Invalidate(fFocusRowRect);
|
Invalidate(fFocusRowRect);
|
||||||
}
|
}
|
||||||
|
BRow* oldFocusRow = fFocusRow;
|
||||||
fFocusRow = newRow;
|
fFocusRow = newRow;
|
||||||
fFocusRowRect.top = top;
|
fFocusRowRect.top = top;
|
||||||
fFocusRowRect.left = 0;
|
fFocusRowRect.left = 0;
|
||||||
@ -4021,12 +4022,32 @@ OutlineView::ChangeFocusRow(bool up, bool updateSelection,
|
|||||||
DeselectAll();
|
DeselectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the focus row isn't selected, add it to the selection
|
||||||
if (fFocusRow->fNextSelected == 0) {
|
if (fFocusRow->fNextSelected == 0) {
|
||||||
fFocusRow->fNextSelected
|
fFocusRow->fNextSelected
|
||||||
= fSelectionListDummyHead.fNextSelected;
|
= fSelectionListDummyHead.fNextSelected;
|
||||||
fFocusRow->fPrevSelected = &fSelectionListDummyHead;
|
fFocusRow->fPrevSelected = &fSelectionListDummyHead;
|
||||||
fFocusRow->fNextSelected->fPrevSelected = fFocusRow;
|
fFocusRow->fNextSelected->fPrevSelected = fFocusRow;
|
||||||
fFocusRow->fPrevSelected->fNextSelected = fFocusRow;
|
fFocusRow->fPrevSelected->fNextSelected = fFocusRow;
|
||||||
|
} else if (oldFocusRow != NULL
|
||||||
|
&& fSelectionListDummyHead.fNextSelected == oldFocusRow
|
||||||
|
&& (((IndexOf(oldFocusRow->fNextSelected)
|
||||||
|
< IndexOf(oldFocusRow)) == up)
|
||||||
|
|| fFocusRow == oldFocusRow->fNextSelected)) {
|
||||||
|
// if the focus row is selected, if:
|
||||||
|
// 1. the previous focus row is last in the selection
|
||||||
|
// 2a. the next selected row is now the focus row
|
||||||
|
// 2b. or the next selected row is beyond the focus row
|
||||||
|
// in the move direction
|
||||||
|
// then deselect the previous focus row
|
||||||
|
fSelectionListDummyHead.fNextSelected
|
||||||
|
= oldFocusRow->fNextSelected;
|
||||||
|
if (fSelectionListDummyHead.fNextSelected != NULL) {
|
||||||
|
fSelectionListDummyHead.fNextSelected->fPrevSelected
|
||||||
|
= &fSelectionListDummyHead;
|
||||||
|
oldFocusRow->fNextSelected = NULL;
|
||||||
|
}
|
||||||
|
oldFocusRow->fPrevSelected = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fLastSelectedItem = fFocusRow;
|
fLastSelectedItem = fFocusRow;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user