Stop passing invalid coordinates to ExtendOrCreateCurrentBlock()
This made the logic of this function unnecessarily more complicated. Instead, just fall back to the current cell coordinates in the only place where this could happen before. Doing this still preserves the correct behaviour of Shift-arrow selection when entire rows/columns are selected and the current cell is not the leftmost/topmost cell (due to scrolling), but the code is simpler. Remove the now always true condition check and assert that it's indeed always true. Note that the changes to gridsel.cpp in this commit are best viewed ignoring whitespace changes.
This commit is contained in:
@@ -7925,12 +7925,17 @@ bool
|
||||
wxGrid::PrepareForSelectionExpansion(wxGridCellCoords& coords,
|
||||
const wxGridDirectionOperations& diroper)
|
||||
{
|
||||
coords.SetRow(m_selection->GetCurrentBlockCornerRow());
|
||||
coords.SetCol(m_selection->GetCurrentBlockCornerCol());
|
||||
int row = m_selection->GetCurrentBlockCornerRow();
|
||||
if ( row == -1 )
|
||||
row = m_currentCellCoords.GetRow();
|
||||
|
||||
if ( coords == wxGridNoCellCoords )
|
||||
coords = m_currentCellCoords;
|
||||
else if ( !diroper.IsValid(coords) )
|
||||
int col = m_selection->GetCurrentBlockCornerCol();
|
||||
if ( col == -1 )
|
||||
col = m_currentCellCoords.GetCol();
|
||||
|
||||
coords.Set(row, col);
|
||||
|
||||
if ( !diroper.IsValid(coords) )
|
||||
{
|
||||
// The component of the current block corner in our direction
|
||||
// is not valid. This means we can't change the selection block
|
||||
|
Reference in New Issue
Block a user