diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index 7a36ab4da..fcadd36f2 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -25,7 +25,7 @@ enum LangType {L_TXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\ L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\ L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\ L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT,\ - L_CMAKE, L_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R,\ + L_CMAKE, L_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R, L_JSP,\ // The end of enumated language type, so it should be always at the end L_EXTERNAL}; enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7}; diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 4f0dd4836..59540d067 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -157,12 +157,12 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vectorLoadFile()) + if (!pXmlDoc->LoadFile()) { - delete _pXmlDoc; - _pXmlDoc = NULL; + delete pXmlDoc; + pXmlDoc = NULL; throw generic_string(generic_string(xmlPath) + TEXT(" failed to load.")); } @@ -170,8 +170,8 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vectoraddExternalLangToEnd(containers[x]); - nppParams->getExternalLexerFromXmlTree(_pXmlDoc); - nppParams->getExternalLexerDoc()->push_back(_pXmlDoc); + nppParams->getExternalLexerFromXmlTree(pXmlDoc); + nppParams->getExternalLexerDoc()->push_back(pXmlDoc); #ifdef UNICODE const char *pDllName = wmc->wchar2char(pluginFilePath, CP_ACP); #else diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 8b50f44a2..307a78ca8 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -5199,6 +5199,7 @@ void Notepad_plus::command(int id) case IDM_LANG_GUI4CLI : case IDM_LANG_POWERSHELL : case IDM_LANG_R : + case IDM_LANG_JSP : case IDM_LANG_USER : { setLanguage(menuID2LangType(id)); @@ -5539,6 +5540,8 @@ enum LangType Notepad_plus::menuID2LangType(int cmdID) return L_PHP; case IDM_LANG_ASP : return L_ASP; + case IDM_LANG_JSP : + return L_JSP; case IDM_LANG_CSS : return L_CSS; case IDM_LANG_LUA : diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 2d96c3d41..10282c706 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -547,6 +547,7 @@ BEGIN MENUITEM "INNO", IDM_LANG_INNO MENUITEM "Java", IDM_LANG_JAVA MENUITEM "Javascript", IDM_LANG_JS + MENUITEM "JSP", IDM_LANG_JSP MENUITEM "KIXtart", IDM_LANG_KIX MENUITEM "LISP", IDM_LANG_LISP MENUITEM "Lua", IDM_LANG_LUA @@ -623,6 +624,7 @@ BEGIN BEGIN MENUITEM "Java", IDM_LANG_JAVA MENUITEM "Javascript", IDM_LANG_JS + MENUITEM "JSP", IDM_LANG_JSP END MENUITEM "KIXtart", IDM_LANG_KIX POPUP "L" diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 5ac08f82e..66c360f18 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -790,13 +790,25 @@ bool NppParameters::load() // langs.xml : for every user statically // //---------------------------------------// generic_string langs_xml_path(_nppPath); - PathAppend(langs_xml_path, TEXT("langs.xml")); - if (!PathFileExists(langs_xml_path.c_str())) + + BOOL doRecover = FALSE; + if (::PathFileExists(langs_xml_path.c_str())) + { + struct _stat buf; + + if (generic_stat(langs_xml_path.c_str(), &buf)==0) + if (buf.st_size == 0) + doRecover = ::MessageBox(NULL, TEXT("Load langs.xml failed!\rDo you want to recover your langs.xml?"), TEXT("Configurator"),MB_YESNO); + } + else + doRecover = true; + + if (doRecover) { generic_string srcLangsPath(_nppPath); PathAppend(srcLangsPath, TEXT("langs.model.xml")); - ::CopyFile(srcLangsPath.c_str(), langs_xml_path.c_str(), TRUE); + ::CopyFile(srcLangsPath.c_str(), langs_xml_path.c_str(), FALSE); } _pXmlDoc = new TiXmlDocument(langs_xml_path); @@ -1116,7 +1128,8 @@ void NppParameters::setFontList(HWND hWnd) void NppParameters::getLangKeywordsFromXmlTree() { - TiXmlNode *root = _pXmlDoc->FirstChild(TEXT("NotepadPlus")); + TiXmlNode *root = + _pXmlDoc->FirstChild(TEXT("NotepadPlus")); if (!root) return; feedKeyWordsParameters(root); } @@ -4577,6 +4590,8 @@ int NppParameters::langTypeToCommandID(LangType lt) const id = IDM_LANG_PHP; break; case L_ASP : id = IDM_LANG_ASP; break; + case L_JSP : + id = IDM_LANG_JSP; break; case L_CSS : id = IDM_LANG_CSS; break; case L_LUA : diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index c30010db3..e1bdd5f82 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -109,6 +109,7 @@ LanguageName ScintillaEditView::langNames[L_EXTERNAL+1] = { {TEXT("d"), TEXT("D"), TEXT("D programming language"), L_D, SCLEX_D}, {TEXT("powershell"), TEXT("PowerShell"), TEXT("Windows PowerShell"), L_POWERSHELL, SCLEX_POWERSHELL}, {TEXT("r"), TEXT("R"), TEXT("R programming language"), L_R, SCLEX_R}, +{TEXT("jsp"), TEXT("JSP"), TEXT("Java Server Pages script file"), L_JSP, SCLEX_HTML}, {TEXT("ext"), TEXT("External"), TEXT("External"), L_EXTERNAL, SCLEX_NULL} }; @@ -497,7 +498,7 @@ void ScintillaEditView::setXmlLexer(LangType type) makeStyle(type); } - else if ((type == L_HTML) || (type == L_PHP) || (type == L_ASP)) + else if ((type == L_HTML) || (type == L_PHP) || (type == L_ASP) || (type == L_JSP)) { execute(SCI_SETLEXER, SCLEX_HTML); const TCHAR *htmlKeyWords_generic =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR); @@ -512,7 +513,7 @@ void ScintillaEditView::setXmlLexer(LangType type) makeStyle(L_HTML); setEmbeddedJSLexer(); - setPhpEmbeddedLexer(); + setEmbeddedPhpLexer(); setEmbeddedAspLexer(); } } @@ -539,7 +540,7 @@ void ScintillaEditView::setEmbeddedJSLexer() execute(SCI_STYLESETEOLFILLED, SCE_HJ_COMMENTDOC, true); } -void ScintillaEditView::setPhpEmbeddedLexer() +void ScintillaEditView::setEmbeddedPhpLexer() { const TCHAR *pKwArray[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; makeStyle(L_PHP, pKwArray); @@ -1115,6 +1116,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc) case L_PHP : case L_ASP : + case L_JSP : case L_HTML : case L_XML : setXmlLexer(typeDoc); break; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 56e664cb3..5b792e3f8 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -659,7 +659,7 @@ protected: void setUserLexer(const TCHAR *userLangName = NULL); void setExternalLexer(LangType typeDoc); void setEmbeddedJSLexer(); - void setPhpEmbeddedLexer(); + void setEmbeddedPhpLexer(); void setEmbeddedAspLexer(); //Simple lexers void setCssLexer() { diff --git a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp index 2eddd53ff..5bfa101dc 100644 --- a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp @@ -448,7 +448,7 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr) // Detect the current lang type. It works only with html and xml LangType lang = (_pEditView->getCurrentBuffer())->getLangType(); - if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP) + if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP && lang != L_JSP) return; // Get the original targets and search options to restore after tag matching operation diff --git a/PowerEditor/src/langs.model.xml b/PowerEditor/src/langs.model.xml index 63c4df1ea..21d9a40e6 100644 --- a/PowerEditor/src/langs.model.xml +++ b/PowerEditor/src/langs.model.xml @@ -110,6 +110,7 @@ abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with true false prototype + ? and beep big break call cd cls color cookie1 copy debug del dim display do until exit flushkb for each next function endfunction get gets global go gosub goto if else endif md or password play quit rd redim return run select case endselect set setl setm settime shell sleep small use while loop abs addkey addprinterconnection addprogramgroup addprogramitem asc ascan at backupeventlog box cdbl chr cint cleareventlog close comparefiletimes createobject cstr dectohex delkey delprinterconnection delprogramgroup delprogramitem deltree delvalue dir enumgroup enumipinfo enumkey enumlocalgroup enumvalue execute exist existkey expandenvironmentvars fix formatnumber freefilehandle getdiskspace getfileattr getfilesize getfiletime getfileversion getobject iif ingroup instr instrrev int isdeclared join kbhit keyexist lcase left len loadhive loadkey logevent logoff ltrim memorysize messagebox open readline readprofilestring readtype readvalue redirectoutput right rnd round rtrim savekey sendkeys sendmessage setascii setconsole setdefaultprinter setfileattr setfocus setoption setsystemstate settitle setwallpaper showprogramgroup shutdown sidtoname split srnd substr trim ubound ucase unloadhive val vartype vartypename writeline writeprofilestring writevalue diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 499844afd..482fe12ac 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -353,6 +353,7 @@ #define IDM_LANG_GUI4CLI (IDM_LANG + 52) #define IDM_LANG_POWERSHELL (IDM_LANG + 53) #define IDM_LANG_R (IDM_LANG + 54) + #define IDM_LANG_JSP (IDM_LANG + 55) #define IDM_LANG_EXTERNAL (IDM_LANG + 65) #define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 79)