From 61abf06bf36a262ea24b5451fa13e75e8c2111ef Mon Sep 17 00:00:00 2001 From: Scott Sumner <30118311+sasumner@users.noreply.github.com> Date: Fri, 2 Aug 2019 14:42:24 -0400 Subject: [PATCH] Make 'Clear all marks' and 'Inverse Bookmark' macroable Fix #1948, close #5995 --- PowerEditor/src/NppCommands.cpp | 1 + .../src/ScitillaComponent/FindReplaceDlg.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 5bae2e8b..61a13040 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -3383,6 +3383,7 @@ void Notepad_plus::command(int id) case IDM_SEARCH_NEXT_BOOKMARK: case IDM_SEARCH_PREV_BOOKMARK: case IDM_SEARCH_CLEAR_BOOKMARKS: + case IDM_SEARCH_INVERSEMARKS: case IDM_EDIT_SELECTALL: case IDM_EDIT_INS_TAB: case IDM_EDIT_RMV_TAB: diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 03072ca9..e58ace31 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -1331,6 +1331,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM { if (_currentStatus == MARK_DLG) { + if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND); (*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE); (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); setStatusbarMessage(TEXT(""), FSNoMessage); @@ -2509,7 +2510,7 @@ void FindReplaceDlg::saveInMacro(size_t cmd, int cmdType) { int booleans = 0; ::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_INIT, 0); - ::SendMessage(_hParent, WM_FRSAVE_STR, IDFINDWHAT, reinterpret_cast(_options._str2Search.c_str())); + ::SendMessage(_hParent, WM_FRSAVE_STR, IDFINDWHAT, reinterpret_cast(cmd == IDC_CLEAR_ALL ? TEXT("") : _options._str2Search.c_str())); booleans |= _options._isWholeWord?IDF_WHOLEWORD:0; booleans |= _options._isMatchCase?IDF_MATCHCASE:0; booleans |= _options._dotMatchesNewline?IDF_REDOTMATCHNL:0; @@ -2535,6 +2536,10 @@ void FindReplaceDlg::saveInMacro(size_t cmd, int cmdType) booleans |= _options._isWrapAround?IDF_WRAP:0; booleans |= _options._whichDirection?IDF_WHICH_DIRECTION:0; } + if (cmd == IDC_CLEAR_ALL) + { + booleans = 0; + } ::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_BOOLEANS, booleans); ::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd); } @@ -2764,6 +2769,13 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st break; } + case IDC_CLEAR_ALL: + { + (*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE); + (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK); + break; + } + default: throw std::runtime_error("Internal error: unknown saved command!"); }