Order symbols by unit/convert

This keeps the output symbol names in human-readable order

Fixes https://gitlab.com/kicad/code/kicad/issues/6376
This commit is contained in:
Seth Hillbrand 2020-11-19 15:18:46 -08:00
parent c9fb595f64
commit 3ff22fc882
1 changed files with 7 additions and 0 deletions

View File

@ -1596,6 +1596,13 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFo
// Save the draw items grouped by units.
std::vector<PART_UNITS> units = aSymbol->GetUnitDrawItems();
std::sort( units.begin(), units.end(), []( const PART_UNITS& a, const PART_UNITS& b )
{
if( a.m_unit == b.m_unit )
return a.m_convert < b.m_convert;
return a.m_unit < b.m_unit;
} );
for( auto unit : units )
{