Optimize Scintilla notification code performance (part 2)

Turn off modification events for some Scintilla controls.

Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/15981#issuecomment-2565003286

Close #16009
This commit is contained in:
Don Ho 2025-01-03 04:26:14 +01:00
parent f40df3cdf1
commit c17d1d428d
4 changed files with 12 additions and 6 deletions

View File

@ -224,6 +224,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_subEditView.init(_pPublicInterface->getHinst(), hwnd); _subEditView.init(_pPublicInterface->getHinst(), hwnd);
_fileEditView.init(_pPublicInterface->getHinst(), hwnd); _fileEditView.init(_pPublicInterface->getHinst(), hwnd);
_fileEditView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); // Turn off the modification event
MainFileManager.init(this, &_fileEditView); //get it up and running asap. MainFileManager.init(this, &_fileEditView); //get it up and running asap.
nppParam.setFontList(hwnd); nppParam.setFontList(hwnd);
@ -280,6 +281,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_invisibleEditView.init(_pPublicInterface->getHinst(), hwnd); _invisibleEditView.init(_pPublicInterface->getHinst(), hwnd);
_invisibleEditView.execute(SCI_SETUNDOCOLLECTION); _invisibleEditView.execute(SCI_SETUNDOCOLLECTION);
_invisibleEditView.execute(SCI_EMPTYUNDOBUFFER); _invisibleEditView.execute(SCI_EMPTYUNDOBUFFER);
_invisibleEditView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); // Turn off the modification event
_invisibleEditView.wrap(false); // Make sure no slow down _invisibleEditView.wrap(false); // Make sure no slow down
// Configuration of 2 scintilla views // Configuration of 2 scintilla views
@ -629,8 +631,8 @@ LRESULT Notepad_plus::init(HWND hwnd)
if (nppParam.hasCustomContextMenu()) if (nppParam.hasCustomContextMenu())
{ {
_mainEditView.execute(SCI_USEPOPUP, FALSE); _mainEditView.execute(SCI_USEPOPUP, SC_POPUP_NEVER);
_subEditView.execute(SCI_USEPOPUP, FALSE); _subEditView.execute(SCI_USEPOPUP, SC_POPUP_NEVER);
} }
_nativeLangSpeaker.changeMenuLang(_mainMenuHandle); _nativeLangSpeaker.changeMenuLang(_mainMenuHandle);

View File

@ -3595,7 +3595,8 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder->setFinderReadOnly(true); _pFinder->setFinderReadOnly(true);
_pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_UTF8); _pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_UTF8);
_pFinder->_scintView.execute(SCI_USEPOPUP, FALSE); _pFinder->_scintView.execute(SCI_USEPOPUP, SC_POPUP_NEVER);
_pFinder->_scintView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); // Turn off the modification event
_pFinder->_scintView.execute(SCI_SETUNDOCOLLECTION, false); //dont store any undo information _pFinder->_scintView.execute(SCI_SETUNDOCOLLECTION, false); //dont store any undo information
_pFinder->_scintView.execute(SCI_SETCARETWIDTH, 1); _pFinder->_scintView.execute(SCI_SETCARETWIDTH, 1);
_pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_FOLDER, true); _pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_FOLDER, true);
@ -3743,7 +3744,8 @@ Finder * FindReplaceDlg::createFinder()
pFinder->setFinderReadOnly(true); pFinder->setFinderReadOnly(true);
pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_UTF8); pFinder->_scintView.execute(SCI_SETCODEPAGE, SC_CP_UTF8);
pFinder->_scintView.execute(SCI_USEPOPUP, FALSE); pFinder->_scintView.execute(SCI_USEPOPUP, SC_POPUP_NEVER);
pFinder->_scintView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); // Turn off the modification event
pFinder->_scintView.execute(SCI_SETUNDOCOLLECTION, false); //dont store any undo information pFinder->_scintView.execute(SCI_SETUNDOCOLLECTION, false); //dont store any undo information
pFinder->_scintView.execute(SCI_SETCARETWIDTH, 1); pFinder->_scintView.execute(SCI_SETCARETWIDTH, 1);
pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_FOLDER, true); pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_FOLDER, true);

View File

@ -329,6 +329,7 @@ intptr_t CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
_pMapView->execute(SCI_SETZOOM, static_cast<WPARAM>(-10), 0); _pMapView->execute(SCI_SETZOOM, static_cast<WPARAM>(-10), 0);
_pMapView->execute(SCI_SETVSCROLLBAR, FALSE, 0); _pMapView->execute(SCI_SETVSCROLLBAR, FALSE, 0);
_pMapView->execute(SCI_SETHSCROLLBAR, FALSE, 0); _pMapView->execute(SCI_SETHSCROLLBAR, FALSE, 0);
_pMapView->execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); // Turn off the modification event
_pMapView->showIndentGuideLine(false); _pMapView->showIndentGuideLine(false);
_pMapView->display(); _pMapView->display();

View File

@ -29,6 +29,7 @@ intptr_t CALLBACK DocumentPeeker::run_dlgProc(UINT message, WPARAM /*wParam*/, L
_pPeekerView->execute(SCI_SETZOOM, static_cast<WPARAM>(-10), 0); _pPeekerView->execute(SCI_SETZOOM, static_cast<WPARAM>(-10), 0);
_pPeekerView->execute(SCI_SETVSCROLLBAR, FALSE, 0); _pPeekerView->execute(SCI_SETVSCROLLBAR, FALSE, 0);
_pPeekerView->execute(SCI_SETHSCROLLBAR, FALSE, 0); _pPeekerView->execute(SCI_SETHSCROLLBAR, FALSE, 0);
_pPeekerView->execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); // Turn off the modification event
_pPeekerView->showIndentGuideLine(false); _pPeekerView->showIndentGuideLine(false);