diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 67ef61894..9fece5f7b 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -129,6 +129,7 @@ The comments are here for explanation, it's not necessary to translate them. + diff --git a/PowerEditor/src/MISC/Common/Sorters.h b/PowerEditor/src/MISC/Common/Sorters.h index 60212d349..9dd087f0a 100644 --- a/PowerEditor/src/MISC/Common/Sorters.h +++ b/PowerEditor/src/MISC/Common/Sorters.h @@ -426,6 +426,18 @@ protected: } }; +class ReverseSorter : public ISorter +{ +public: + ReverseSorter(bool isDescending, size_t fromColumn, size_t toColumn) : ISorter(isDescending, fromColumn, toColumn) { }; + + std::vector sort(std::vector lines) override + { + std::reverse(lines.begin(), lines.end()); + return lines; + } +}; + class RandomSorter : public ISorter { public: diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 7b57a61e9..7ea4f7066 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -451,6 +451,7 @@ BEGIN MENUITEM "Sort Lines As Decimals (Comma) Descending", IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING MENUITEM "Sort Lines As Decimals (Dot) Descending", IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING MENUITEM SEPARATOR + MENUITEM "Reverse Line Order", IDM_EDIT_SORTLINES_REVERSE_ORDER MENUITEM "Sort Lines Randomly", IDM_EDIT_SORTLINES_RANDOMLY END POPUP "Comment/Uncomment" diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index bf134b19e..d15de1f92 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -577,6 +577,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING: case IDM_EDIT_SORTLINES_DECIMALDOT_ASCENDING: case IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING: + case IDM_EDIT_SORTLINES_REVERSE_ORDER: case IDM_EDIT_SORTLINES_RANDOMLY: { std::lock_guard lock(command_mutex); @@ -657,6 +658,10 @@ void Notepad_plus::command(int id) { pSorter = std::unique_ptr(new DecimalDotSorter(isDescending, fromColumn, toColumn)); } + else if (id == IDM_EDIT_SORTLINES_REVERSE_ORDER) + { + pSorter = std::unique_ptr(new ReverseSorter(isDescending, fromColumn, toColumn)); + } else { pSorter = std::unique_ptr(new RandomSorter(isDescending, fromColumn, toColumn)); @@ -3688,6 +3693,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING: case IDM_EDIT_SORTLINES_DECIMALDOT_ASCENDING: case IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING: + case IDM_EDIT_SORTLINES_REVERSE_ORDER: case IDM_EDIT_SORTLINES_RANDOMLY: case IDM_EDIT_BLANKLINEABOVECURRENT: case IDM_EDIT_BLANKLINEBELOWCURRENT: diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 79aad0154..39f044ef8 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -135,6 +135,7 @@ static const WinMenuKeyDefinition winKeyDefs[] = { VK_NULL, IDM_EDIT_SORTLINES_DECIMALCOMMA_DESCENDING, false, false, false, nullptr }, { VK_NULL, IDM_EDIT_SORTLINES_DECIMALDOT_ASCENDING, false, false, false, nullptr }, { VK_NULL, IDM_EDIT_SORTLINES_DECIMALDOT_DESCENDING, false, false, false, nullptr }, + { VK_NULL, IDM_EDIT_SORTLINES_REVERSE_ORDER, false, false, false, nullptr }, { VK_NULL, IDM_EDIT_SORTLINES_RANDOMLY, false, false, false, nullptr }, { VK_Q, IDM_EDIT_BLOCK_COMMENT, true, false, false, nullptr }, { VK_K, IDM_EDIT_BLOCK_COMMENT_SET, true, false, false, nullptr }, diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 30a1c6317..a85d02d15 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -164,6 +164,7 @@ #define IDM_EDIT_SORTLINES_LEXICO_CASE_INSENS_ASCENDING (IDM_EDIT + 80) #define IDM_EDIT_SORTLINES_LEXICO_CASE_INSENS_DESCENDING (IDM_EDIT + 81) #define IDM_EDIT_COPY_LINK (IDM_EDIT + 82) + #define IDM_EDIT_SORTLINES_REVERSE_ORDER (IDM_EDIT + 83) #define IDM_EDIT_AUTOCOMPLETE (50000 + 0) #define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000 + 1)