Symbol Fields Table: better column moving
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16123
This commit is contained in:
parent
2661e7a8ee
commit
4d5841cc98
|
@ -98,7 +98,15 @@ public:
|
||||||
void MoveColumn( int aCol, int aNewPos )
|
void MoveColumn( int aCol, int aNewPos )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aCol >= 0 && aCol < (int) m_cols.size(), "Invalid Column Number" );
|
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(); }
|
int GetNumberRows() override { return (int) m_rows.size(); }
|
||||||
|
|
Loading…
Reference in New Issue