Prevent stale selection when deleting grid rows.

This commit is contained in:
Jeff Young
2025-07-24 18:16:21 +01:00
parent f877425e62
commit 14c9ed1fda
22 changed files with 326 additions and 668 deletions
+6 -11
View File
@@ -229,17 +229,12 @@ void DIALOG_PLUGIN_OPTIONS::onAppendRow( wxCommandEvent& )
void DIALOG_PLUGIN_OPTIONS::onDeleteRow( wxCommandEvent& )
{
if( !m_grid->CommitPendingChanges() )
return;
int curRow = m_grid->GetGridCursorRow();
m_grid->DeleteRows( curRow );
m_grid_widths_dirty = true;
curRow = std::max( 0, curRow - 1 );
m_grid->MakeCellVisible( curRow, m_grid->GetGridCursorCol() );
m_grid->SetGridCursor( curRow, m_grid->GetGridCursorCol() );
m_grid->OnDeleteRows(
[&]( int row )
{
m_grid->DeleteRows( row );
m_grid_widths_dirty = true;
} );
}