From c5dedff99f306588a7217d40a4281db7d1baffaa Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 11 Oct 2018 09:29:05 +1100 Subject: Add SCI_SETCOMMANDEVENTS API to allow turning off command events. This can reduce the time taken to fold a document by half. --- src/Editor.cxx | 16 +++++++++++++--- src/Editor.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index ad26a62d8..83cb6fec6 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -181,6 +181,7 @@ Editor::Editor() { needIdleStyling = false; modEventMask = SC_MODEVENTMASKALL; + commandEvents = true; pdoc->AddWatcher(this, 0); @@ -2677,9 +2678,11 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { // If client wants to see this modification if (mh.modificationType & modEventMask) { - if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { - // Real modification made to text of document. - NotifyChange(); // Send EN_CHANGE + if (commandEvents) { + if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { + // Real modification made to text of document. + NotifyChange(); // Send EN_CHANGE + } } SCNotification scn = {}; @@ -7651,6 +7654,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETMODEVENTMASK: return modEventMask; + case SCI_SETCOMMANDEVENTS: + commandEvents = static_cast(wParam); + return 0; + + case SCI_GETCOMMANDEVENTS: + return commandEvents; + case SCI_CONVERTEOLS: pdoc->ConvertLineEnds(static_cast(wParam)); SetSelection(sel.MainCaret(), sel.MainAnchor()); // Ensure selection inside document diff --git a/src/Editor.h b/src/Editor.h index fb892bdcb..a75461afe 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -229,6 +229,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool needIdleStyling; int modEventMask; + bool commandEvents; SelectionText drag; -- cgit v1.2.3