Fix preserving selection when changing selection mode in wxGrid
The loop over the existing selection was buggy and took into account only one corner of the block instead of the entire block and also skipped some blocks entirely. Closes #17572.
This commit is contained in:
@@ -144,14 +144,15 @@ void wxGridSelection::SetSelectionMode( wxGrid::wxGridSelectionModes selmode )
|
||||
}
|
||||
|
||||
// Note that m_blockSelectionTopLeft's size may be changing!
|
||||
for (n = 0; n < m_blockSelectionTopLeft.GetCount(); n++)
|
||||
for ( n = m_blockSelectionTopLeft.GetCount(); n > 0; )
|
||||
{
|
||||
n--;
|
||||
wxGridCellCoords& coords = m_blockSelectionTopLeft[n];
|
||||
int topRow = coords.GetRow();
|
||||
int leftCol = coords.GetCol();
|
||||
coords = m_blockSelectionBottomRight[n];
|
||||
int bottomRow = coords.GetRow();
|
||||
int rightCol = coords.GetCol();
|
||||
wxGridCellCoords& coords2 = m_blockSelectionBottomRight[n];
|
||||
int bottomRow = coords2.GetRow();
|
||||
int rightCol = coords2.GetCol();
|
||||
|
||||
if (selmode == wxGrid::wxGridSelectRows)
|
||||
{
|
||||
|
Reference in New Issue
Block a user