Make 'Clear all marks' and 'Inverse Bookmark' macroable

Fix #1948, close #5995
This commit is contained in:
Scott Sumner 2019-08-02 14:42:24 -04:00 committed by Don HO
parent b3a6638b93
commit 61abf06bf3
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
2 changed files with 14 additions and 1 deletions

View File

@ -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:

View File

@ -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<LPARAM>(_options._str2Search.c_str()));
::SendMessage(_hParent, WM_FRSAVE_STR, IDFINDWHAT, reinterpret_cast<LPARAM>(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!");
}