-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Notepad++ can sort lines in various ways, including the reverse of each sort option. But there is no way to reverse the existing order of lines. This Super User question from 10 years ago, with 117 upvotes, has a suggested workaround of inserting line numbers, sorting in descending order, and deleting line numbers, which is a quite convoluted and inconvenient way of achieving this result.
I am hoping that the usefulness of this feature would be evident to most that I don't need to list many reasons; at any rate I am sure that 77 thousand people who viewed that question had many more use cases than I can think of and list. In my case, I needed this feature because Notepad++ Regex replace didn't support variable-length lookbehind. I wanted to replace
# title
- item
- item
# title2
- item
...
with
title - item
title - item
title2 - item
which required variable-length lookbehind to get the previous title for every line. My simple workaround was reversing lines, doing a variable-length lookahead, and reversing the lines again. But I had to use an external solution to reverse line orders (which also meant that it wasn't macro-able), it would be much simpler with a Notepad++ command. This is a fairly technical use case, but I would assume that more casual users desire this feature, as they simply want to invert their lists for whatever reason. I also have some lists that being able to easily reverse them occasionally would come in handy.
Finally, I would use @sasumner's reason in [Feature Request] Sort lines randomly (i.e., shuffle lines) (#8682) (whose pull request is what I used as a model to code mine): "We have ranDOm CasE, why not have Sort lines randomly?" -> "We have iNVERT cASE, why note have Reverse line order?".
For consistency with the Convert Case menu, I placed the proposed "Reverse line order" item just above the "Sort lines randomly" item.