diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 93b9e4dae..949485657 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -112,6 +112,7 @@ The comments are here for explanation, it's not necessary to translate them. + @@ -1317,7 +1318,18 @@ Your settings on cloud will be canceled. Please reset a coherent value via Prefe - + diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index e93d1bc53..3083ffa08 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -435,6 +435,7 @@ BEGIN MENUITEM "&Delete", IDM_EDIT_DELETE MENUITEM "&Select All", IDM_EDIT_SELECTALL MENUITEM "Begin/End &Select", IDM_EDIT_BEGINENDSELECT + MENUITEM "Begin/End Select in Column Mode", IDM_EDIT_BEGINENDSELECT_COLUMNMODE MENUITEM SEPARATOR POPUP "Insert" BEGIN diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 53fecc3d5..b3537d2c5 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -630,9 +630,13 @@ void Notepad_plus::command(int id) break; case IDM_EDIT_BEGINENDSELECT: + case IDM_EDIT_BEGINENDSELECT_COLUMNMODE: { - ::CheckMenuItem(_mainMenuHandle, IDM_EDIT_BEGINENDSELECT, MF_BYCOMMAND | (_pEditView->beginEndSelectedIsStarted() ? MF_UNCHECKED : MF_CHECKED)); - _pEditView->beginOrEndSelect(); + _pEditView->beginOrEndSelect(id == IDM_EDIT_BEGINENDSELECT_COLUMNMODE); + bool isStarted = _pEditView->beginEndSelectedIsStarted(); + ::CheckMenuItem(_mainMenuHandle, id, MF_BYCOMMAND | (isStarted ? MF_CHECKED : MF_UNCHECKED)); + int otherId = (id == IDM_EDIT_BEGINENDSELECT) ? IDM_EDIT_BEGINENDSELECT_COLUMNMODE : IDM_EDIT_BEGINENDSELECT; + ::EnableMenuItem(_mainMenuHandle, otherId, MF_BYCOMMAND | (isStarted ? (MF_DISABLED | MF_GRAYED) : MF_ENABLED)); } break; @@ -1602,7 +1606,14 @@ void Notepad_plus::command(int id) { _nativeLangSpeaker.messageBox("ColumnModeTip", _pPublicInterface->getHSelf(), - TEXT("Please use \"ALT+Mouse Selection\" or \"Alt+Shift+Arrow key\" to switch to column mode."), + TEXT("There are 3 ways to switch to column-select mode:\r\n\r\n") + TEXT("1. (Keyboard and Mouse) Hold Alt while left-click dragging\r\n\r\n") + TEXT("2. (Keyboard only) Hold Alt+Shift while using arrow keys\r\n\r\n") + TEXT("3. (Keyboard or Mouse)\r\n") + TEXT(" Put caret at desired start of column block position, then\r\n") + TEXT(" execute \"Begin/End Select in Column Mode\" command;\r\n") + TEXT(" Move caret to desired end of column block position, then\r\n") + TEXT(" execute \"Begin/End Select in Column Mode\" command again\r\n"), TEXT("Column Mode Tip"), MB_OK|MB_APPLMODAL); } @@ -3975,6 +3986,7 @@ void Notepad_plus::command(int id) case IDM_EDIT_RTL : case IDM_EDIT_LTR : case IDM_EDIT_BEGINENDSELECT: + case IDM_EDIT_BEGINENDSELECT_COLUMNMODE: case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_ASCENDING: case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING: case IDM_EDIT_SORTLINES_LEXICO_CASE_INSENS_ASCENDING: diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 5125d107b..71a998b2a 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -102,7 +102,8 @@ static const WinMenuKeyDefinition winKeyDefs[] = // { VK_NULL, IDM_EDIT_PASTE, false, false, false, nullptr }, // { VK_NULL, IDM_EDIT_DELETE, false, false, false, nullptr }, // { VK_NULL, IDM_EDIT_SELECTALL, false, false, false, nullptr }, - { VK_NULL, IDM_EDIT_BEGINENDSELECT, false, false, false, nullptr }, + { VK_B, IDM_EDIT_BEGINENDSELECT, true, false, true, nullptr }, + { VK_B, IDM_EDIT_BEGINENDSELECT_COLUMNMODE, false, true, true, nullptr }, { VK_NULL, IDM_EDIT_FULLPATHTOCLIP, false, false, false, nullptr }, { VK_NULL, IDM_EDIT_FILENAMETOCLIP, false, false, false, nullptr }, diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index a32a492eb..bd3b34dd0 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -2520,7 +2520,7 @@ void ScintillaEditView::addText(size_t length, const char *buf) execute(SCI_ADDTEXT, length, reinterpret_cast(buf)); } -void ScintillaEditView::beginOrEndSelect() +void ScintillaEditView::beginOrEndSelect(bool isColumnMode) { if (_beginSelectPosition == -1) { @@ -2528,6 +2528,7 @@ void ScintillaEditView::beginOrEndSelect() } else { + execute(SCI_SETSELECTIONMODE, static_cast(isColumnMode ? SC_SEL_RECTANGLE : SC_SEL_STREAM)); execute(SCI_SETANCHOR, static_cast(_beginSelectPosition)); _beginSelectPosition = -1; } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 14f472a5e..8cf82a2c1 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -262,7 +262,7 @@ public: void restoreCurrentPosPreStep(); void restoreCurrentPosPostStep(); - void beginOrEndSelect(); + void beginOrEndSelect(bool isColumnMode); bool beginEndSelectedIsStarted() const { return _beginSelectPosition != -1; }; diff --git a/PowerEditor/src/contextMenu.xml b/PowerEditor/src/contextMenu.xml index 58f31c081..eb9f97708 100644 --- a/PowerEditor/src/contextMenu.xml +++ b/PowerEditor/src/contextMenu.xml @@ -19,6 +19,7 @@ https://npp-user-manual.org/docs/config-files/#the-context-menu-contextmenu-xml + diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index 9d1500e5b..366a862a1 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -46,17 +46,17 @@ MenuPosition menuPos[] = { { 0, 13, -1, "file-closeMore" }, { 0, 22, -1, "file-recentFiles" }, - { 1, 10, -1, "edit-insert" }, - { 1, 11, -1, "edit-copyToClipboard" }, - { 1, 12, -1, "edit-indent" }, - { 1, 13, -1, "edit-convertCaseTo" }, - { 1, 14, -1, "edit-lineOperations" }, - { 1, 15, -1, "edit-comment" }, - { 1, 16, -1, "edit-autoCompletion" }, - { 1, 17, -1, "edit-eolConversion" }, - { 1, 18, -1, "edit-blankOperations" }, - { 1, 19, -1, "edit-pasteSpecial" }, - { 1, 20, -1, "edit-onSelection" }, + { 1, 11, -1, "edit-insert" }, + { 1, 12, -1, "edit-copyToClipboard" }, + { 1, 13, -1, "edit-indent" }, + { 1, 14, -1, "edit-convertCaseTo" }, + { 1, 15, -1, "edit-lineOperations" }, + { 1, 16, -1, "edit-comment" }, + { 1, 17, -1, "edit-autoCompletion" }, + { 1, 18, -1, "edit-eolConversion" }, + { 1, 19, -1, "edit-blankOperations" }, + { 1, 20, -1, "edit-pasteSpecial" }, + { 1, 21, -1, "edit-onSelection" }, { 2, 18, -1, "search-markAll" }, { 2, 19, -1, "search-markOne" }, diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index c516762b3..70adf5357 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -170,6 +170,7 @@ #define IDM_EDIT_INSERT_DATETIME_CUSTOMIZED (IDM_EDIT + 86) #define IDM_EDIT_COPY_ALL_NAMES (IDM_EDIT + 87) #define IDM_EDIT_COPY_ALL_PATHS (IDM_EDIT + 88) + #define IDM_EDIT_BEGINENDSELECT_COLUMNMODE (IDM_EDIT + 89) #define IDM_EDIT_AUTOCOMPLETE (50000 + 0) #define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000 + 1)