Sorting of units/demorgan in .kicad_sym file is not consistent
Description
This is what the content of Amplifier_Audio.kicad_sym looks like:
(symbol "SSM2120_2_1"
(rectangle (start -5.08 7.62) (end 5.08 -5.08)
(stroke (width 0.254)) (fill (type background))
)
(pin input line (at -7.62 5.08 0) (length 2.54)
(name "THRESH" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin input line (at -7.62 2.54 0) (length 2.54)
(name "LOGAV" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin input line (at 7.62 0 180) (length 2.54)
(name "CONOUT" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27))))
)
(pin input line (at -7.62 -2.54 0) (length 2.54)
(name "RECIN" (effects (font (size 1.27 1.27))))
(number "9" (effects (font (size 1.27 1.27))))
)
)
(symbol "SSM2120_4_1"
(rectangle (start -5.08 7.62) (end 5.08 -5.08)
(stroke (width 0.254)) (fill (type background))
)
(pin input line (at -7.62 5.08 0) (length 2.54)
(name "THRESH" (effects (font (size 1.27 1.27))))
(number "12" (effects (font (size 1.27 1.27))))
)
(pin input line (at -7.62 2.54 0) (length 2.54)
(name "LOGAV" (effects (font (size 1.27 1.27))))
(number "13" (effects (font (size 1.27 1.27))))
)
(pin input line (at 7.62 0 180) (length 2.54)
(name "CONOUT" (effects (font (size 1.27 1.27))))
(number "14" (effects (font (size 1.27 1.27))))
)
(pin input line (at -7.62 -2.54 0) (length 2.54)
(name "RECIN" (effects (font (size 1.27 1.27))))
(number "15" (effects (font (size 1.27 1.27))))
)
)
(symbol "SSM2120_1_1"
I would expect that the SSM2120_x_y
are sorted by xy.
Currently I am working on unit-tests of the kicad-library-utils symbol generator code. One test is to read a kicad_sym and then write it again. Then compare against the original file. The output of my code is sorted, but the one of kicad is not.
So I am wondering if this is by design, and if not, can it be fixed easily?
Steps to reproduce
- Open Amplifier_Audio.kicad_sym from the official lib.
- Navigate to symbol SSM2120
- Make a minor edit (e.g. move REFDES)
- Save the library
- Items are not ordered
KiCad Version
Application: LibEdit
Version: 5.99.0-unknown-dbcb1ecdb~104~ubuntu20.10.1, release build
Libraries:
wxWidgets 3.0.5
libcurl/7.72.0 OpenSSL/1.1.1g zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.8.0 nghttp2/1.41.0 librtmp/2.3
Platform: Linux 5.8.0-2-amd64 x86_64, 64 bit, Little endian, wxGTK, i3, x11
Build Info:
Date: Oct 25 2020 10:19:24
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OCE: 6.9.1
Curl: 7.68.0
ngspice: 32
Compiler: GCC 10.2.0 with C++ ABI 1014
Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_SPICE=ON