mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
Fix incorrect syntax hiliting by switching from wrong langType to right one
Regression was introduced by commit b2152d983e3b20aed7f687ba1d9e916ae6065b24 Fix #16271, close #16281
This commit is contained in:
parent
25a40b9a62
commit
0ead95eb86
@ -3892,7 +3892,7 @@ void Notepad_plus::setLanguage(LangType langType)
|
|||||||
_subEditView.execute(SCI_SETDOCPOINTER, 0, 0);
|
_subEditView.execute(SCI_SETDOCPOINTER, 0, 0);
|
||||||
_subEditView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_ON);
|
_subEditView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_ON);
|
||||||
|
|
||||||
_mainEditView.setLanguage(langType);
|
(_mainEditView.getCurrentBuffer())->setLangType(langType);
|
||||||
|
|
||||||
_subEditView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF);
|
_subEditView.execute(SCI_SETMODEVENTMASK, MODEVENTMASK_OFF);
|
||||||
_subEditView.execute(SCI_SETDOCPOINTER, 0, subPrev);
|
_subEditView.execute(SCI_SETDOCPOINTER, 0, subPrev);
|
||||||
@ -3903,7 +3903,7 @@ void Notepad_plus::setLanguage(LangType langType)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_pEditView->setLanguage(langType);
|
(_pEditView->getCurrentBuffer())->setLangType(langType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4135,15 +4135,6 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NPPM_INTERNAL_RELOADFUNCTIONLIST:
|
|
||||||
{
|
|
||||||
if (_pFuncList && (!_pFuncList->isClosed()) && _pFuncList->isVisible())
|
|
||||||
{
|
|
||||||
_pFuncList->reload();
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
case NPPM_INTERNAL_SQLBACKSLASHESCAPE:
|
case NPPM_INTERNAL_SQLBACKSLASHESCAPE:
|
||||||
{
|
{
|
||||||
// Go through all open files, and if there are any SQL files open, make sure the sql.backslash.escapes propery
|
// Go through all open files, and if there are any SQL files open, make sure the sql.backslash.escapes propery
|
||||||
|
@ -1717,42 +1717,6 @@ void ScintillaEditView::setNpcAndCcUniEOL(long color)
|
|||||||
redraw();
|
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)
|
void ScintillaEditView::defineDocType(LangType typeDoc)
|
||||||
{
|
{
|
||||||
@ -2171,10 +2135,10 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
|||||||
|
|
||||||
Document ScintillaEditView::getBlankDocument()
|
Document ScintillaEditView::getBlankDocument()
|
||||||
{
|
{
|
||||||
if(_blankDocument==0)
|
if (!_blankDocument)
|
||||||
{
|
{
|
||||||
_blankDocument=static_cast<Document>(execute(SCI_CREATEDOCUMENT,0,SC_DOCUMENTOPTION_TEXT_LARGE));
|
_blankDocument = static_cast<Document>(execute(SCI_CREATEDOCUMENT, 0, SC_DOCUMENTOPTION_TEXT_LARGE));
|
||||||
execute(SCI_ADDREFDOCUMENT,0,_blankDocument);
|
execute(SCI_ADDREFDOCUMENT, 0, _blankDocument);
|
||||||
}
|
}
|
||||||
return _blankDocument;
|
return _blankDocument;
|
||||||
}
|
}
|
||||||
|
@ -828,7 +828,6 @@ public:
|
|||||||
typeDoc == L_ASN1 || typeDoc == L_GDSCRIPT);
|
typeDoc == L_ASN1 || typeDoc == L_GDSCRIPT);
|
||||||
};
|
};
|
||||||
|
|
||||||
void setLanguage(LangType langType);
|
|
||||||
void defineDocType(LangType typeDoc); //setup stylers for active document
|
void defineDocType(LangType typeDoc); //setup stylers for active document
|
||||||
|
|
||||||
void addCustomWordChars();
|
void addCustomWordChars();
|
||||||
|
@ -746,7 +746,7 @@
|
|||||||
#define NPPM_INTERNAL_LWINDENT (NOTEPADPLUS_USER_INTERNAL + 105)
|
#define NPPM_INTERNAL_LWINDENT (NOTEPADPLUS_USER_INTERNAL + 105)
|
||||||
#define NPPM_INTERNAL_CHECKDOCSTATUS (NOTEPADPLUS_USER_INTERNAL + 106)
|
#define NPPM_INTERNAL_CHECKDOCSTATUS (NOTEPADPLUS_USER_INTERNAL + 106)
|
||||||
#define NPPM_INTERNAL_HIDEMENURIGHTSHORTCUTS (NOTEPADPLUS_USER_INTERNAL + 107)
|
#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)
|
#define NPPM_INTERNAL_SQLBACKSLASHESCAPE (NOTEPADPLUS_USER_INTERNAL + 109)
|
||||||
|
|
||||||
// See Notepad_plus_msgs.h
|
// See Notepad_plus_msgs.h
|
||||||
|
Loading…
x
Reference in New Issue
Block a user