It is no longer acceptable to set a LIB_FIELD index to -1. This was
trashing the sorting on load cause all kinds of false field comparison
failures. There are now assertions when attempting to use -1 as a field
index.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9811
This fix required sorting all of the LIB_PART draw items to ensure
accurate comparison between the symbols stored in the schematic and the
original library symbols. This has a noticeable impact on symbol library
load performance. It may also cause significant changes the next time
the library is saved due to changes in the draw item sorting. Hashing
may be a better solution here but this addressed the immediate problem.
A skeleton method SCH_SCREEN::SwapSymbolLinks() was added because there
is most likely an issue with orphaned symbols in the schematic library
symbol cache during undo/redo operations. More testing is required to
verify this.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7263