Fix item position in sorted generic wxDataViewCtrl
Compare the item whose value has changed with both the previous and the next items, if any. Closes #19194.
This commit is contained in:
committed by
Vadim Zeitlin
parent
80b3348c39
commit
527bcb246b
@@ -1968,15 +1968,15 @@ wxDataViewTreeNode::PutChildInSortOrder(wxDataViewMainWindow* window,
|
|||||||
// Check if we actually need to move the node.
|
// Check if we actually need to move the node.
|
||||||
bool locationChanged = false;
|
bool locationChanged = false;
|
||||||
|
|
||||||
if ( oldLocation == 0 )
|
// Compare with next node
|
||||||
|
if ( oldLocation != hi - 1)
|
||||||
{
|
{
|
||||||
// Compare with the next item (as we return early in the case of only a
|
if ( !cmp(childNode, nodes[oldLocation + 1]) )
|
||||||
// single child, we know that there is one) to check if the item is now
|
|
||||||
// out of order.
|
|
||||||
if ( !cmp(childNode, nodes[1]) )
|
|
||||||
locationChanged = true;
|
locationChanged = true;
|
||||||
}
|
}
|
||||||
else // Compare with the previous item.
|
|
||||||
|
// Compare with previous node
|
||||||
|
if ( !locationChanged && oldLocation > 0 )
|
||||||
{
|
{
|
||||||
if ( !cmp(nodes[oldLocation - 1], childNode) )
|
if ( !cmp(nodes[oldLocation - 1], childNode) )
|
||||||
locationChanged = true;
|
locationChanged = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user