Allow selecting rows/columns in row-or-column selection mode

Don't blankly forbid selecting any blocks at all in this mode, this
didn't really make any sense.

Moreover, SelectBlock() not doing anything prevented wxGrid code
handling {Ctrl,Shift}-Space from doing anything in this mode and, worse,
broke the logic of DeselectBlock() which relied on using SelectBlock()
to select the remaining parts of the selection, so this commit fixes
using Ctrl-click for deselecting rows or columns in this selection mode,
which was previously completely broken.
This commit is contained in:
Vadim Zeitlin 2020-04-15 00:03:37 +02:00
parent 3ebc76eea5
commit 51ea80b701

View File

@ -186,9 +186,16 @@ void wxGridSelection::SelectBlock( int topRow, int leftCol,
break;
case wxGrid::wxGridSelectRowsOrColumns:
// block selection doesn't make sense for this mode, we could only
// select the entire grid but this wouldn't be useful
allowed = 0;
// Arbitrary block selection doesn't make sense for this mode, as
// we could only select the entire grid, which wouldn't be useful,
// but we do allow selecting blocks that are already composed of
// only rows or only columns.
if ( topRow == 0 && bottomRow == m_grid->GetNumberRows() - 1 )
allowed = 1;
else if ( leftCol == 0 && rightCol == m_grid->GetNumberCols() - 1 )
allowed = 1;
else
allowed = 0;
break;
}