diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 26ce7874b..5a997eddb 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -2737,12 +2737,19 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool { if (op == ProcessReplaceAll && (*_ppEditView)->getCurrentBuffer()->isReadOnly()) { - NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); + NppParameters& nppParam = NppParameters::getInstance(); + NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker(); generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-readonly", TEXT("Replace All: Cannot replace text. The current document is read only.")); setStatusbarMessage(msg, FSNotFound); return 0; } + // Turn OFF all the notification of modification (SCN_MODIFIED) for the sake of performance + LRESULT notifFlag = (*_ppEditView)->execute(SCI_GETMODEVENTMASK); + (*_ppEditView)->execute(SCI_SETMODEVENTMASK, 0); + + + const FindOption *pOptions = opt?opt:_env; const TCHAR *txt2find = pOptions->_str2Search.c_str(); const TCHAR *txt2replace = pOptions->_str4Replace.c_str(); @@ -2805,6 +2812,13 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool int nbProcessed = processRange(op, findReplaceInfo, pFindersInfo, pOptions, colourStyleID); + + // Turn ON the notifications after operations + (*_ppEditView)->execute(SCI_SETMODEVENTMASK, notifFlag); + if (op == ProcessReplaceAll && nbProcessed > 0) // All the notification of modification (SCN_MODIFIED) were removed during the operations, so we set modified status true here + (*_ppEditView)->getCurrentBuffer()->setModifiedStatus(true); + + if (nbProcessed == FIND_INVALID_REGULAR_EXPRESSION) return FIND_INVALID_REGULAR_EXPRESSION; diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index bb1c126fe..4cd8df9e2 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -234,6 +234,10 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) throw std::runtime_error("ScintillaEditView::init : SCI_GETDIRECTPOINTER message failed"); } + // Set only the notification we need. + execute(SCI_SETMODEVENTMASK, SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MOD_CHANGEINDICATOR); + execute(SCI_SETCOMMANDEVENTS, false); + execute(SCI_SETMARGINMASKN, _SC_MARGE_FOLDER, SC_MASK_FOLDERS); showMargin(_SC_MARGE_FOLDER, true);