Finish editing on Enter in cells in the last shown row of wxGrid

Previously, pressing Enter in a cell of a row which wasn't the last one,
but was the last shown one, didn't do anything because we explicitly
checked whether the cell was in the last row and not in the last visible
row, but MoveCursorDown() doesn't move the cursor for the latter, and
not just for the former.

Fix this by avoiding any row checks at all and just calling
MoveCursorDown() in any case and DisableCellEditControl() if it didn't
do anything.

Closes #18754.
This commit is contained in:
Vadim Zeitlin
2020-05-02 17:45:51 +02:00
parent f5001e728c
commit ebe7816516

View File

@@ -5707,13 +5707,11 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
}
else
{
if ( GetGridCursorRow() < GetNumberRows()-1 )
if ( !MoveCursorDown( event.ShiftDown() ) )
{
MoveCursorDown( event.ShiftDown() );
}
else
{
// at the bottom of a column
// Normally this would be done by MoveCursorDown(), but
// if it failed to move the cursor, e.g. because we're
// at the bottom of a column, do it here.
DisableCellEditControl();
}
}