Symbol Fields Table: better column moving

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16123
This commit is contained in:
Mike Williams 2023-12-06 09:39:10 -05:00
parent 2661e7a8ee
commit 4d5841cc98
1 changed files with 9 additions and 1 deletions

View File

@ -98,7 +98,15 @@ public:
void MoveColumn( int aCol, int aNewPos )
{
wxCHECK_RET( aCol >= 0 && aCol < (int) m_cols.size(), "Invalid Column Number" );
std::swap( m_cols[aCol], m_cols[aNewPos] );
if( aCol == aNewPos )
return;
else if( aCol < aNewPos )
std::rotate( std::begin( m_cols ) + aCol, std::begin( m_cols ) + aCol + 1,
std::begin( m_cols ) + aNewPos + 1 );
else
std::rotate( std::begin( m_cols ) + aNewPos, std::begin( m_cols ) + aCol,
std::begin( m_cols ) + aCol + 1 );
}
int GetNumberRows() override { return (int) m_rows.size(); }