Correctly handle hidden columns when pasting into grids.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14844
This commit is contained in:
Jeff Young 2023-05-31 12:25:47 +01:00
parent 8baf2a832f
commit f9fd37c4ca
1 changed files with 4 additions and 6 deletions

View File

@ -766,18 +766,16 @@ void GRID_TRICKS::paste_text( const wxString& cb_text )
wxStringTokenizer cols( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );
if( !is_selection )
{
end_col = cur_col + cols.CountTokens();
if( end_col > tbl->GetNumberCols() )
end_col = tbl->GetNumberCols();
}
for( int col = start_col; col < end_col; ++col )
for( int col = start_col; col < end_col && col < tbl->GetNumberCols(); ++col )
{
// Skip hidden columns
if( !m_grid->IsColShown( col ) )
{
end_col++;
continue;
}
// If number of selected cols is larger than the count of cols on the clipboard,
// paste again and again until the end of the selection is reached.