diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index f57ab90f4..61a1954be 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3892,7 +3892,7 @@ void Notepad_plus::setLanguage(LangType langType) _subEditView.execute(SCI_SETDOCPOINTER, 0, 0); _subEditView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_ON); - _mainEditView.setLanguage(langType); + (_mainEditView.getCurrentBuffer())->setLangType(langType); _subEditView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); _subEditView.execute(SCI_SETDOCPOINTER, 0, subPrev); @@ -3903,7 +3903,7 @@ void Notepad_plus::setLanguage(LangType langType) } else { - _pEditView->setLanguage(langType); + (_pEditView->getCurrentBuffer())->setLangType(langType); } } diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 306d9a214..7ba622135 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -4135,15 +4135,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return TRUE; } - case NPPM_INTERNAL_RELOADFUNCTIONLIST: - { - if (_pFuncList && (!_pFuncList->isClosed()) && _pFuncList->isVisible()) - { - _pFuncList->reload(); - } - return TRUE; - } - case NPPM_INTERNAL_SQLBACKSLASHESCAPE: { // Go through all open files, and if there are any SQL files open, make sure the sql.backslash.escapes propery diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 98f7d61d6..40d620882 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -1717,42 +1717,6 @@ void ScintillaEditView::setNpcAndCcUniEOL(long color) redraw(); } -void ScintillaEditView::setLanguage(LangType langType) -{ - unsigned long MODEVENTMASK_ON = NppParameters::getInstance().getScintillaModEventMask(); - - if (_currentBuffer->getLastLangType() > 0 && !_currentBuffer->isUntitled()) - { - // To improve switching lexer performance, here's the tip: - // 1. Set current document to a blank document - // 2. Set a new lexer - // 3. Reset back to the current document - saveCurrentPos(); - Document prev = execute(SCI_GETDOCPOINTER); - execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); - execute(SCI_SETDOCPOINTER, 0, getBlankDocument()); - execute(SCI_SETMODEVENTMASK, MODEVENTMASK_ON); - - _currentBuffer->setLangType(langType); - - execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF); - execute(SCI_SETDOCPOINTER, 0, prev); - execute(SCI_SETMODEVENTMASK, MODEVENTMASK_ON); - - maintainStateForNpc(); - setCRLF(); - restoreCurrentPosPreStep(); - - // When buffer sets lang type ("_currentBuffer->setLangType(langType);"), it'll call doNotify(BufferChangeLanguage | BufferChangeLexing), - // then FunctionList will be reloaded. However, it'll be reloaded on the blank document. - // That's why here we do again FunctionList reload, after the current document be reset back. - ::SendMessage(_hParent, NPPM_INTERNAL_RELOADFUNCTIONLIST, 0, 0); - } - else - { - _currentBuffer->setLangType(langType); - } -} void ScintillaEditView::defineDocType(LangType typeDoc) { @@ -2171,10 +2135,10 @@ void ScintillaEditView::defineDocType(LangType typeDoc) Document ScintillaEditView::getBlankDocument() { - if(_blankDocument==0) + if (!_blankDocument) { - _blankDocument=static_cast(execute(SCI_CREATEDOCUMENT,0,SC_DOCUMENTOPTION_TEXT_LARGE)); - execute(SCI_ADDREFDOCUMENT,0,_blankDocument); + _blankDocument = static_cast(execute(SCI_CREATEDOCUMENT, 0, SC_DOCUMENTOPTION_TEXT_LARGE)); + execute(SCI_ADDREFDOCUMENT, 0, _blankDocument); } return _blankDocument; } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 9849539e3..dd8cccfb0 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -828,7 +828,6 @@ public: typeDoc == L_ASN1 || typeDoc == L_GDSCRIPT); }; - void setLanguage(LangType langType); void defineDocType(LangType typeDoc); //setup stylers for active document void addCustomWordChars(); diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index a6de712a2..1e1c8a0db 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -746,7 +746,7 @@ #define NPPM_INTERNAL_LWINDENT (NOTEPADPLUS_USER_INTERNAL + 105) #define NPPM_INTERNAL_CHECKDOCSTATUS (NOTEPADPLUS_USER_INTERNAL + 106) #define NPPM_INTERNAL_HIDEMENURIGHTSHORTCUTS (NOTEPADPLUS_USER_INTERNAL + 107) - #define NPPM_INTERNAL_RELOADFUNCTIONLIST (NOTEPADPLUS_USER_INTERNAL + 108) + //#define NPPM_INTERNAL_ (NOTEPADPLUS_USER_INTERNAL + 108) #define NPPM_INTERNAL_SQLBACKSLASHESCAPE (NOTEPADPLUS_USER_INTERNAL + 109) // See Notepad_plus_msgs.h