Don't paste into hidden columns.

Fixes https://gitlab.com/kicad/code/kicad/issues/10168

(cherry picked from commit c27ec5cae1)
This commit is contained in:
Jeff Young 2022-02-18 17:11:57 +00:00
parent 9fcd4113b0
commit b041a77cfa
1 changed files with 8 additions and 6 deletions

View File

@ -642,9 +642,8 @@ void GRID_TRICKS::paste_text( const wxString& cb_text )
for( int row = start_row; row < end_row; ++row ) for( int row = start_row; row < end_row; ++row )
{ {
// If number of selected rows bigger than count of rows in // If number of selected rows is larger than the count of rows on the clipboard, paste
// the clipboard, paste from the clipboard again and again // again and again until the end of the selection is reached.
// while end of the selection is reached.
if( !rows.HasMoreTokens() ) if( !rows.HasMoreTokens() )
rows.SetString( cb_text, ROW_SEP, wxTOKEN_RET_EMPTY ); rows.SetString( cb_text, ROW_SEP, wxTOKEN_RET_EMPTY );
@ -662,9 +661,12 @@ void GRID_TRICKS::paste_text( const wxString& cb_text )
for( int col = start_col; col < end_col; ++col ) for( int col = start_col; col < end_col; ++col )
{ {
// If number of selected columns bigger than count of columns in // Skip hidden columns
// the clipboard, paste from the clipboard again and again while if( !m_grid->IsColShown( col ) )
// end of the selection is reached. 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.
if( !cols.HasMoreTokens() ) if( !cols.HasMoreTokens() )
cols.SetString( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY ); cols.SetString( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );