Commit Graph

11 Commits

Author SHA1 Message Date
Göran W
a916403618 enhance: make NumericSort use InvariantCulture instead of Ordinal comparison (#1724)
Ordinal comparison sorts non-alphanumeric chars (like underscore etc) differently than expected (i.e compared to filesystem sorting etc).
InvariantCulture comparison corrects this, without imposing cultural differences. (A possible alternative would be CurrentCulture comparison.)
The earlier code, when comparing a single digit-char against non-digit-char, used char.CompareTo() where the comparison method can not be specified.
To fix this, we now use the same Comparer for all non-all-digits string comparisons.
2025-08-25 09:59:28 +08:00
leo
f88652ffdd code_review: PR #1417
Remove unnecessary namespace using

Signed-off-by: leo <longshuang@msn.cn>
2025-06-13 17:12:14 +08:00
Göran W
8dffdef48d refactor: reduce redundant code in NumericSort (#1417)
* Refactor the 2 do-loops into simpler while-loops and replace the use of "tmp1/2" char-arrays with calls to String.Substring().
* Rename the "loc1/2" variables to "subLen1/2", for clarity, since they represent the lengths of the two extracted Substrings.

These changes make the logic more compact and easier to follow.
2025-06-13 17:06:35 +08:00
Nathan Baulch
ffac71b15f code_style: general cleanup (#1415)
* code_style:  general cleanup

* code_style: whitespace cleanup
2025-06-12 09:35:37 +08:00
leo
f59851f454 refactor: case-insensitive sorting
- `ToUpper` is not necessary to compare digit char with non-digit char
- use numeric sorting for commit decorators with same type

Signed-off-by: leo <longshuang@msn.cn>
2025-06-11 20:25:41 +08:00
leo
5494093261 refactor: now all filesystem related trees/lists are sorted in case-insensitive mode
Signed-off-by: leo <longshuang@msn.cn>
2025-06-11 15:20:50 +08:00
leo
489b57858f enhance: improve NumericSort.Compare performance
Signed-off-by: leo <longshuang@msn.cn>
2024-10-29 09:36:26 +08:00
leo
48725a7937 code_review: PR #612
Signed-off-by: leo <longshuang@msn.cn>
2024-10-28 19:42:54 +08:00
ybeapps
a363f67f31 bug: fix int out of bounds for branch names with long numbers (#612) 2024-10-28 19:24:43 +08:00
leo
d3d71af0e8 enhance: only alloc temp buffer once time (#597)
Signed-off-by: leo <longshuang@msn.cn>
2024-10-24 17:07:30 +08:00
leo
76a7a2228f feature: use numeric sorting for all trees (#597)
Signed-off-by: leo <longshuang@msn.cn>
2024-10-24 15:11:10 +08:00