diff --git a/lib/sort-lines.coffee b/lib/sort-lines.coffee index 640832c..5baa97c 100644 --- a/lib/sort-lines.coffee +++ b/lib/sort-lines.coffee @@ -28,11 +28,11 @@ sortTextLines = (editor, sorter) -> sortLines = (editor) -> sortTextLines editor, (textLines) -> - textLines.sort (a, b) -> a.localeCompare(b) + textLines.sort (a, b) -> if a is b then 0 else if a > b then 1 else -1 sortLinesReversed = (editor) -> sortTextLines editor, (textLines) -> - textLines.sort (a, b) -> b.localeCompare(a) + textLines.sort (a, b) -> if a is b then 0 else if a < b then 1 else -1 uniqueLines = (editor) -> sortTextLines editor, (textLines) -> @@ -40,7 +40,10 @@ uniqueLines = (editor) -> sortLinesInsensitive = (editor) -> sortTextLines editor, (textLines) -> - textLines.sort (a, b) -> a.toLowerCase().localeCompare(b.toLowerCase()) + textLines.sort (a, b) -> + a = a.toLowerCase() + b = b.toLowerCase() + if a is b then 0 else if a > b then 1 else -1 sortLinesNatural = (editor) -> sortTextLines editor, (textLines) ->