Fix bug with Shift-Enter selecting cells while editing

It was unexpected that pressing Shift-Enter while an editor was active
didn't close it, but just selected the cell below (and then the one
below it if pressed again and so on), so now always finish editing when
it's pressed.

It could be argued that it's still unexpected for Shift-Enter to select
the cell below after closing the editor, but this is consistent with how
Tab works, and so shouldn't be as confusing as the old behaviour.
This commit is contained in:
Vadim Zeitlin
2020-06-28 22:58:20 +02:00
parent 3747169660
commit 4e62b24042

View File

@@ -5696,13 +5696,14 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
}
else
{
if ( !MoveCursorDown( event.ShiftDown() ) )
{
// 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();
}
// We want to accept the changes in the editor when Enter
// is pressed in any case, so do it (note that in many
// cases this would be done by MoveCursorDown() itself, but
// not always, e.g. it wouldn't do it when editing the
// cells in the last row or when using Shift-Enter).
DisableCellEditControl();
MoveCursorDown( event.ShiftDown() );
}
break;