Sort Lines Lexicographically did not work
-
@Cooeeeee said in Sort Lines Lexicographically did not work:
I’ve been using Notepad++ for years. My most used feature is Sort Lexicographically to sort a column mode selection (i.e. I essentially have a table of data). For example, I’ll use Alt+Shift and maybe select columns 27-30 across all lines, then do a lexicographical sort on that.
Today I encountered a list that wasn’t sorting correctly. I’ve not had this problem before. My lines had some tabs prior to the columns I was trying to sort. Reading through this thread gave me the idea to try the “TAB to space” conversion. My listed would sort correctly after making that adjustment. Somehow the tabs were breaking it. I figured I’ll leave this tip here in case it can help anyone else.
Indeed, sorting by column does not work if there are tabs before the columns. No doubt for efficiency, the column sort in Notepad++ determines a single pair of starting and ending character positions to apply to all lines, rather than independently extracting the selected text on every line; tabs are treated as single characters, no matter how wide they are on the display.
If you’re interested in a pre-release version of a plugin, Columns++ includes a sort function which works as expected when there are tabs in the document.