Sublime Forum

Sort Lines does not sort hyphens (-) alphabetically

#1

When sorting alphabetically, words with hyphens should come after the same word without a hyphen.

Currently, Sublime’s Sort Lines sorts these lines this way:

    border-radius
    border
    width

They should be sorted this way:

    border
    border-radius
    width

Is there a way to change this? Or is it a bug? If so can it please get fixes?

0 Likes

#2

works fine for me - what version of ST are you using? and on what platform in case it makes a difference?

I tested in build 3120 on Windows 7 x64. The default Python sort method on the list is used. (sort.py in the Default package.)

You could also try in the ST console to see if it makes any difference:

>>> l = ['width', 'border-radius', 'border']; l.sort(); print(l)
['border', 'border-radius', 'width']
1 Like

#3

I’m using Sublime Text 3 Build 3114 on OSX.

I have two co-workers with the same set up and they have the same problem.

0 Likes

#4

hmm, I just tested in build 3114 on Linux, and it also works fine. Maybe it’s a Python on a Mac bug…

Just to check, does it do the same without any packages enabled? i.e. maybe a package is overriding it with bad behavior.

0 Likes

#5

I have a similar problem:

\acro{ICMPv6}{Internet Control Message Protocol Version 6}
\acro{ICMP}{Internet Control Message Protocol}

I would like to have it the other way around, longer abbreviations should be below shorter abbreviations. I guess in my case it is because Sublime doesn’t sort context aware and } is after v. Any idea how to change that?

0 Likes

#6
>>> ord('{')
123
>>> ord('v')
118
>>> ord('-')
45

Perfectly fine.

0 Likes

#7

I believe the problem encountered by the poster but not clearly specificed, is that it is sorting - against :.

>>> ord(":")
58
>>> ord("-")
45
0 Likes