mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-29 00:34:24 +02:00
Add Begin/End Select in Column Mode command
Fix #12833, fix #12832, close #13034
This commit is contained in:
parent
5aeb8abb5d
commit
07924528c4
@ -112,6 +112,7 @@ The comments are here for explanation, it's not necessary to translate them.
|
|||||||
<Item id="42006" name="&Delete"/>
|
<Item id="42006" name="&Delete"/>
|
||||||
<Item id="42007" name="&Select All"/>
|
<Item id="42007" name="&Select All"/>
|
||||||
<Item id="42020" name="Begin/End &Select"/>
|
<Item id="42020" name="Begin/End &Select"/>
|
||||||
|
<Item id="42089" name="Begin/End Select in Column Mode"/>
|
||||||
<Item id="42084" name="Date Time (short)"/>
|
<Item id="42084" name="Date Time (short)"/>
|
||||||
<Item id="42085" name="Date Time (long)"/>
|
<Item id="42085" name="Date Time (long)"/>
|
||||||
<Item id="42086" name="Date Time (customized)"/>
|
<Item id="42086" name="Date Time (customized)"/>
|
||||||
@ -1317,7 +1318,18 @@ Your settings on cloud will be canceled. Please reset a coherent value via Prefe
|
|||||||
<DroppingFolderAsProjectModeWarning title="Invalid action" message="You can only drop files or folders but not both, because you're in dropping Folder as Project mode.
|
<DroppingFolderAsProjectModeWarning title="Invalid action" message="You can only drop files or folders but not both, because you're in dropping Folder as Project mode.
|
||||||
you have to enable "Open all files of folder instead of launching Folder as Workspace on folder dropping" in "Default Directory" section of Preferences dialog to make this operation work."/>
|
you have to enable "Open all files of folder instead of launching Folder as Workspace on folder dropping" in "Default Directory" section of Preferences dialog to make this operation work."/>
|
||||||
<SortingError title="Sorting Error" message="Unable to perform numeric sorting due to line $INT_REPLACE$."/> <!-- HowToReproduce: this message prevents from system failure. It's hard to reproduce. -->
|
<SortingError title="Sorting Error" message="Unable to perform numeric sorting due to line $INT_REPLACE$."/> <!-- HowToReproduce: this message prevents from system failure. It's hard to reproduce. -->
|
||||||
<ColumnModeTip title="Column Mode Tip" message="Please use "ALT+Mouse Selection" or "Alt+Shift+Arrow key" to switch to column mode."/>
|
<ColumnModeTip title="Column Mode Tip" message="
|
||||||
|
There are 3 ways to switch to column-select mode:
|
||||||
|
|
||||||
|
1. (Keyboard and Mouse) Hold Alt while left-click dragging
|
||||||
|
|
||||||
|
2. (Keyboard only) Hold Alt+Shift while using arrow keys
|
||||||
|
|
||||||
|
3. (Keyboard or Mouse)
|
||||||
|
Put caret at desired start of column block position, then
|
||||||
|
execute "Begin/End Select in Column Mode" command;
|
||||||
|
Move caret to desired end of column block position, then
|
||||||
|
execute "Begin/End Select in Column Mode" command again"/>
|
||||||
<BufferInvalidWarning title="Save failed" message="Cannot save: Buffer is invalid."/> <!-- HowToReproduce: this message prevents from system failure. It's hard to reproduce. -->
|
<BufferInvalidWarning title="Save failed" message="Cannot save: Buffer is invalid."/> <!-- HowToReproduce: this message prevents from system failure. It's hard to reproduce. -->
|
||||||
<DoCloseOrNot title="Keep non existing file" message="The file "$STR_REPLACE$" doesn't exist anymore.
|
<DoCloseOrNot title="Keep non existing file" message="The file "$STR_REPLACE$" doesn't exist anymore.
|
||||||
Keep this file in editor?"/>
|
Keep this file in editor?"/>
|
||||||
|
@ -435,6 +435,7 @@ BEGIN
|
|||||||
MENUITEM "&Delete", IDM_EDIT_DELETE
|
MENUITEM "&Delete", IDM_EDIT_DELETE
|
||||||
MENUITEM "&Select All", IDM_EDIT_SELECTALL
|
MENUITEM "&Select All", IDM_EDIT_SELECTALL
|
||||||
MENUITEM "Begin/End &Select", IDM_EDIT_BEGINENDSELECT
|
MENUITEM "Begin/End &Select", IDM_EDIT_BEGINENDSELECT
|
||||||
|
MENUITEM "Begin/End Select in Column Mode", IDM_EDIT_BEGINENDSELECT_COLUMNMODE
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
POPUP "Insert"
|
POPUP "Insert"
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -630,9 +630,13 @@ void Notepad_plus::command(int id)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case IDM_EDIT_BEGINENDSELECT:
|
case IDM_EDIT_BEGINENDSELECT:
|
||||||
|
case IDM_EDIT_BEGINENDSELECT_COLUMNMODE:
|
||||||
{
|
{
|
||||||
::CheckMenuItem(_mainMenuHandle, IDM_EDIT_BEGINENDSELECT, MF_BYCOMMAND | (_pEditView->beginEndSelectedIsStarted() ? MF_UNCHECKED : MF_CHECKED));
|
_pEditView->beginOrEndSelect(id == IDM_EDIT_BEGINENDSELECT_COLUMNMODE);
|
||||||
_pEditView->beginOrEndSelect();
|
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;
|
break;
|
||||||
|
|
||||||
@ -1602,7 +1606,14 @@ void Notepad_plus::command(int id)
|
|||||||
{
|
{
|
||||||
_nativeLangSpeaker.messageBox("ColumnModeTip",
|
_nativeLangSpeaker.messageBox("ColumnModeTip",
|
||||||
_pPublicInterface->getHSelf(),
|
_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"),
|
TEXT("Column Mode Tip"),
|
||||||
MB_OK|MB_APPLMODAL);
|
MB_OK|MB_APPLMODAL);
|
||||||
}
|
}
|
||||||
@ -3975,6 +3986,7 @@ void Notepad_plus::command(int id)
|
|||||||
case IDM_EDIT_RTL :
|
case IDM_EDIT_RTL :
|
||||||
case IDM_EDIT_LTR :
|
case IDM_EDIT_LTR :
|
||||||
case IDM_EDIT_BEGINENDSELECT:
|
case IDM_EDIT_BEGINENDSELECT:
|
||||||
|
case IDM_EDIT_BEGINENDSELECT_COLUMNMODE:
|
||||||
case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_ASCENDING:
|
case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_ASCENDING:
|
||||||
case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING:
|
case IDM_EDIT_SORTLINES_LEXICOGRAPHIC_DESCENDING:
|
||||||
case IDM_EDIT_SORTLINES_LEXICO_CASE_INSENS_ASCENDING:
|
case IDM_EDIT_SORTLINES_LEXICO_CASE_INSENS_ASCENDING:
|
||||||
|
@ -102,7 +102,8 @@ static const WinMenuKeyDefinition winKeyDefs[] =
|
|||||||
// { VK_NULL, IDM_EDIT_PASTE, false, false, false, nullptr },
|
// { VK_NULL, IDM_EDIT_PASTE, false, false, false, nullptr },
|
||||||
// { VK_NULL, IDM_EDIT_DELETE, 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_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_FULLPATHTOCLIP, false, false, false, nullptr },
|
||||||
{ VK_NULL, IDM_EDIT_FILENAMETOCLIP, false, false, false, nullptr },
|
{ VK_NULL, IDM_EDIT_FILENAMETOCLIP, false, false, false, nullptr },
|
||||||
|
@ -2520,7 +2520,7 @@ void ScintillaEditView::addText(size_t length, const char *buf)
|
|||||||
execute(SCI_ADDTEXT, length, reinterpret_cast<LPARAM>(buf));
|
execute(SCI_ADDTEXT, length, reinterpret_cast<LPARAM>(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScintillaEditView::beginOrEndSelect()
|
void ScintillaEditView::beginOrEndSelect(bool isColumnMode)
|
||||||
{
|
{
|
||||||
if (_beginSelectPosition == -1)
|
if (_beginSelectPosition == -1)
|
||||||
{
|
{
|
||||||
@ -2528,6 +2528,7 @@ void ScintillaEditView::beginOrEndSelect()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
execute(SCI_SETSELECTIONMODE, static_cast<WPARAM>(isColumnMode ? SC_SEL_RECTANGLE : SC_SEL_STREAM));
|
||||||
execute(SCI_SETANCHOR, static_cast<WPARAM>(_beginSelectPosition));
|
execute(SCI_SETANCHOR, static_cast<WPARAM>(_beginSelectPosition));
|
||||||
_beginSelectPosition = -1;
|
_beginSelectPosition = -1;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ public:
|
|||||||
void restoreCurrentPosPreStep();
|
void restoreCurrentPosPreStep();
|
||||||
void restoreCurrentPosPostStep();
|
void restoreCurrentPosPostStep();
|
||||||
|
|
||||||
void beginOrEndSelect();
|
void beginOrEndSelect(bool isColumnMode);
|
||||||
bool beginEndSelectedIsStarted() const {
|
bool beginEndSelectedIsStarted() const {
|
||||||
return _beginSelectPosition != -1;
|
return _beginSelectPosition != -1;
|
||||||
};
|
};
|
||||||
|
@ -19,6 +19,7 @@ https://npp-user-manual.org/docs/config-files/#the-context-menu-contextmenu-xml
|
|||||||
<Item MenuEntryName="Edit" MenuItemName="Delete"/>
|
<Item MenuEntryName="Edit" MenuItemName="Delete"/>
|
||||||
<Item MenuEntryName="Edit" MenuItemName="Select all"/>
|
<Item MenuEntryName="Edit" MenuItemName="Select all"/>
|
||||||
<Item MenuEntryName="Edit" MenuItemName="Begin/End Select"/>
|
<Item MenuEntryName="Edit" MenuItemName="Begin/End Select"/>
|
||||||
|
<Item MenuEntryName="Edit" MenuItemName="Begin/End Select in Column Mode"/>
|
||||||
|
|
||||||
<!-- id="0" is the separator -->
|
<!-- id="0" is the separator -->
|
||||||
<Item id="0"/>
|
<Item id="0"/>
|
||||||
|
@ -46,17 +46,17 @@ MenuPosition menuPos[] = {
|
|||||||
{ 0, 13, -1, "file-closeMore" },
|
{ 0, 13, -1, "file-closeMore" },
|
||||||
{ 0, 22, -1, "file-recentFiles" },
|
{ 0, 22, -1, "file-recentFiles" },
|
||||||
|
|
||||||
{ 1, 10, -1, "edit-insert" },
|
{ 1, 11, -1, "edit-insert" },
|
||||||
{ 1, 11, -1, "edit-copyToClipboard" },
|
{ 1, 12, -1, "edit-copyToClipboard" },
|
||||||
{ 1, 12, -1, "edit-indent" },
|
{ 1, 13, -1, "edit-indent" },
|
||||||
{ 1, 13, -1, "edit-convertCaseTo" },
|
{ 1, 14, -1, "edit-convertCaseTo" },
|
||||||
{ 1, 14, -1, "edit-lineOperations" },
|
{ 1, 15, -1, "edit-lineOperations" },
|
||||||
{ 1, 15, -1, "edit-comment" },
|
{ 1, 16, -1, "edit-comment" },
|
||||||
{ 1, 16, -1, "edit-autoCompletion" },
|
{ 1, 17, -1, "edit-autoCompletion" },
|
||||||
{ 1, 17, -1, "edit-eolConversion" },
|
{ 1, 18, -1, "edit-eolConversion" },
|
||||||
{ 1, 18, -1, "edit-blankOperations" },
|
{ 1, 19, -1, "edit-blankOperations" },
|
||||||
{ 1, 19, -1, "edit-pasteSpecial" },
|
{ 1, 20, -1, "edit-pasteSpecial" },
|
||||||
{ 1, 20, -1, "edit-onSelection" },
|
{ 1, 21, -1, "edit-onSelection" },
|
||||||
|
|
||||||
{ 2, 18, -1, "search-markAll" },
|
{ 2, 18, -1, "search-markAll" },
|
||||||
{ 2, 19, -1, "search-markOne" },
|
{ 2, 19, -1, "search-markOne" },
|
||||||
|
@ -170,6 +170,7 @@
|
|||||||
#define IDM_EDIT_INSERT_DATETIME_CUSTOMIZED (IDM_EDIT + 86)
|
#define IDM_EDIT_INSERT_DATETIME_CUSTOMIZED (IDM_EDIT + 86)
|
||||||
#define IDM_EDIT_COPY_ALL_NAMES (IDM_EDIT + 87)
|
#define IDM_EDIT_COPY_ALL_NAMES (IDM_EDIT + 87)
|
||||||
#define IDM_EDIT_COPY_ALL_PATHS (IDM_EDIT + 88)
|
#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 (50000 + 0)
|
||||||
#define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000 + 1)
|
#define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000 + 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user