Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting lines as integers/decimals treats dash-delimited parts (1-2-3) as negative #12308

Open
f2d opened this issue Oct 9, 2022 · 2 comments

Comments

@f2d
Copy link

f2d commented Oct 9, 2022

Description of the Issue

I encountered this issue while sorting a list of locations from "Space Engine" program, which include formats like the following:

RG 0-1-3-1242
RG 0-1-0-0
RS 0-9-74233681-1925-4-1-3-125 B
RS 0-9-16710922-2101-2-6-178047-263 4.2
RS 0-1-3-767-6580-7-591743-60 A5b
RS 0-0-0-0-34-0-0-0
RS 71-1826-2-36-423

The above is copied exactly as "line sorted as integers ascending" by Notepad++ v8.4.5 (and 8.4.6).

Expected Behavior

I expected dashes to be treated as delimiter, not as minus sign.

I think it worked like I expected in some previous versions.
Although probably that was a bug, as I see from searching around.

I also want to suggest that if there is any count of dashes between numbers and nothing else, e.g. "1-------------2", then the following number should not be treated as negative.

Actual Behavior

Minux-prefixed parts are treated as negative, with nothing between the minus and the previous number.

P.S. Anyway, this is a minor issue for me, as I only wanted to group together duplicate prefixes, and any order works for that.

@alankilborn
Copy link
Contributor

That Notepad++ does anything at all with your sample lines is a miracle, as your lines do not begin with integers, so the root of this complaint is a PBKAC.

It is also an invalid issue because it did not populate the requested Debug Info from the issue template.

@ArkadiuszMichalski
Copy link
Contributor

ArkadiuszMichalski commented Oct 9, 2022

This sorting uses its own algorithm, and not all cases are (and will be) accounted for.
https://en.wikipedia.org/wiki/Natural_sort_order

However, there are an edge case that we want to ask the community what the intended behavior should be.
#11023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants