Order Categories by Numeric Prefix#100
Conversation
|
Don't do that, just set the Order property https://github.com/BepInEx/BepInEx.ConfigurationManager?tab=readme-ov-file#overriding-default-configuration-manager-behavior Though to be fair I don't remember if this affects category ordering as well, but still changing how strings are sorted just for this is not a great idea. You can add a 0 and it will sort fine, e.g. 01 02 03 ... 10 11 |
|
Category ordering cannot be controlled via ConfigurationManagerAttributes. This only applied to the entry within the section. Adding leading 0's is a bit akward and if not implemented from the beginning, introducing it in a later release requires to regenerating the configuration file. There is not much harm changing the order in which categories are listed to behave more intuitively if they start with a numbering. Of course, a more sophisticated control of category order would be nice but this is a simple change that solves the issue of wrongly ordered numbered sections in the Config Manager. |
|
How about simply keeping the original order of categories in which they were added? I made a quick test and it seems to work fine with all of the plugins I had to test with master...cat-order What do you think? Here's a test build if you want one ConfigurationManager.zip |
|
@ManlyMarco keeping the original order of categories works for me and your test version runs as expected. |
|
Merged #102 with the order change, so I'll close this PR. |
In many mods, categories are prefixed with numbers to control their order. However, since sorting is done lexical, numbers greater than 10 are not ordered intuitively. E.g. "10" comes before "2".
This PR improves category sorting by extracting numeric prefixes and sorting them numerically before applying a lexical sort. Categories without a numeric prefix remain unaffected. Categories with the same number prefix are still sorted lexical.
For example, instead of:
They are now ordered: