diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 0a5c33f78..783166825 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -970,7 +970,7 @@ void ScintillaEditView::setXmlLexer(LangType type) keywordList = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 5, reinterpret_cast(getCompleteKeywordList(keywordList, L_XML, LANG_INDEX_INSTR))); + execute(SCI_SETKEYWORDS, 5, reinterpret_cast(concatToBuildKeywordList(keywordList, L_XML, LANG_INDEX_INSTR))); // the XML portion of the lexer only allows substyles for attributes, not for tags (since it treats all tags the same), // so allocate all 8 substyles to attributes @@ -1007,7 +1007,7 @@ void ScintillaEditView::setHTMLLexer() keywordList = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 0, reinterpret_cast(getCompleteKeywordList(keywordList, L_HTML, LANG_INDEX_INSTR))); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(concatToBuildKeywordList(keywordList, L_HTML, LANG_INDEX_INSTR))); // DOCTYPE command keywords std::string keywordList2; @@ -1017,7 +1017,7 @@ void ScintillaEditView::setHTMLLexer() keywordList2 = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 5, reinterpret_cast(getCompleteKeywordList(keywordList2, L_HTML, LANG_INDEX_INSTR2))); + execute(SCI_SETKEYWORDS, 5, reinterpret_cast(concatToBuildKeywordList(keywordList2, L_HTML, LANG_INDEX_INSTR2))); // HTML allows substyle lists for both tags and attributes, so allocate four of each populateSubStyleKeywords(L_HTML, SCE_H_TAG, 4, LANG_INDEX_SUBSTYLE1, pKwArray); @@ -1036,7 +1036,7 @@ void ScintillaEditView::setEmbeddedJSLexer() keywordList = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 1, reinterpret_cast(getCompleteKeywordList(keywordList, L_JS_EMBEDDED, LANG_INDEX_INSTR))); + execute(SCI_SETKEYWORDS, 1, reinterpret_cast(concatToBuildKeywordList(keywordList, L_JS_EMBEDDED, LANG_INDEX_INSTR))); populateSubStyleKeywords(L_JS_EMBEDDED, SCE_HJ_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray); execute(SCI_STYLESETEOLFILLED, SCE_HJ_DEFAULT, true); execute(SCI_STYLESETEOLFILLED, SCE_HJ_COMMENT, true); @@ -1067,8 +1067,8 @@ void ScintillaEditView::setJsonLexer(bool isJson5) keywordList2 = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 0, reinterpret_cast(getCompleteKeywordList(keywordList, L_JSON, LANG_INDEX_INSTR))); - execute(SCI_SETKEYWORDS, 1, reinterpret_cast(getCompleteKeywordList(keywordList2, L_JSON, LANG_INDEX_INSTR2))); + execute(SCI_SETKEYWORDS, 0, reinterpret_cast(concatToBuildKeywordList(keywordList, L_JSON, LANG_INDEX_INSTR))); + execute(SCI_SETKEYWORDS, 1, reinterpret_cast(concatToBuildKeywordList(keywordList2, L_JSON, LANG_INDEX_INSTR2))); execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); execute(SCI_SETPROPERTY, reinterpret_cast("fold.compact"), reinterpret_cast("0")); @@ -1091,7 +1091,7 @@ void ScintillaEditView::setEmbeddedPhpLexer() keywordList = wstring2string(kwlW, CP_ACP); } - execute(SCI_SETKEYWORDS, 4, reinterpret_cast(getCompleteKeywordList(keywordList, L_PHP, LANG_INDEX_INSTR))); + execute(SCI_SETKEYWORDS, 4, reinterpret_cast(concatToBuildKeywordList(keywordList, L_PHP, LANG_INDEX_INSTR))); populateSubStyleKeywords(L_PHP, SCE_HPHP_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray); execute(SCI_STYLESETEOLFILLED, SCE_HPHP_DEFAULT, true); @@ -1112,7 +1112,7 @@ void ScintillaEditView::setEmbeddedAspLexer() execute(SCI_SETPROPERTY, reinterpret_cast("asp.default.language"), reinterpret_cast("2")); - execute(SCI_SETKEYWORDS, 2, reinterpret_cast(getCompleteKeywordList(keywordList, L_VB, LANG_INDEX_INSTR))); + execute(SCI_SETKEYWORDS, 2, reinterpret_cast(concatToBuildKeywordList(keywordList, L_VB, LANG_INDEX_INSTR))); populateSubStyleKeywords(L_ASP, SCE_HB_WORD, 8, LANG_INDEX_SUBSTYLE1, pKwArray); @@ -1278,7 +1278,7 @@ void ScintillaEditView::setExternalLexer(LangType typeDoc) { keywordList = wstring2string(style._keywords, CP_ACP); } - execute(SCI_SETKEYWORDS, style._keywordClass, reinterpret_cast(getCompleteKeywordList(keywordList, typeDoc, style._keywordClass))); + execute(SCI_SETKEYWORDS, style._keywordClass, reinterpret_cast(concatToBuildKeywordList(keywordList, typeDoc, style._keywordClass))); } } } @@ -1319,21 +1319,21 @@ void ScintillaEditView::setCppLexer(LangType langType) basic_string kwlW = pKwArray[LANG_INDEX_INSTR]; keywordListInstruction = wstring2string(kwlW, CP_ACP); } - cppInstrs = getCompleteKeywordList(keywordListInstruction, langType, LANG_INDEX_INSTR); + cppInstrs = concatToBuildKeywordList(keywordListInstruction, langType, LANG_INDEX_INSTR); if (pKwArray[LANG_INDEX_TYPE]) { basic_string kwlW = pKwArray[LANG_INDEX_TYPE]; keywordListType = wstring2string(kwlW, CP_ACP); } - cppTypes = getCompleteKeywordList(keywordListType, langType, LANG_INDEX_TYPE); + cppTypes = concatToBuildKeywordList(keywordListType, langType, LANG_INDEX_TYPE); if (pKwArray[LANG_INDEX_INSTR2]) { basic_string kwlW = pKwArray[LANG_INDEX_INSTR2]; keywordListGlobalclass = wstring2string(kwlW, CP_ACP); } - cppGlobalclass = getCompleteKeywordList(keywordListGlobalclass, langType, LANG_INDEX_INSTR2); + cppGlobalclass = concatToBuildKeywordList(keywordListGlobalclass, langType, LANG_INDEX_INSTR2); execute(SCI_SETKEYWORDS, 0, reinterpret_cast(cppInstrs)); execute(SCI_SETKEYWORDS, 1, reinterpret_cast(cppTypes)); @@ -1386,21 +1386,21 @@ void ScintillaEditView::setJsLexer() basic_string kwlW = pKwArray[LANG_INDEX_INSTR]; keywordListInstruction = wstring2string(kwlW, CP_ACP); } - const char *jsInstrs = getCompleteKeywordList(keywordListInstruction, L_JAVASCRIPT, LANG_INDEX_INSTR); + const char *jsInstrs = concatToBuildKeywordList(keywordListInstruction, L_JAVASCRIPT, LANG_INDEX_INSTR); if (pKwArray[LANG_INDEX_TYPE]) { basic_string kwlW = pKwArray[LANG_INDEX_TYPE]; keywordListType = wstring2string(kwlW, CP_ACP); } - const char *jsTypes = getCompleteKeywordList(keywordListType, L_JAVASCRIPT, LANG_INDEX_TYPE); + const char *jsTypes = concatToBuildKeywordList(keywordListType, L_JAVASCRIPT, LANG_INDEX_TYPE); if (pKwArray[LANG_INDEX_INSTR2]) { basic_string kwlW = pKwArray[LANG_INDEX_INSTR2]; keywordListInstruction2 = wstring2string(kwlW, CP_ACP); } - const char *jsInstrs2 = getCompleteKeywordList(keywordListInstruction2, L_JAVASCRIPT, LANG_INDEX_INSTR2); + const char *jsInstrs2 = concatToBuildKeywordList(keywordListInstruction2, L_JAVASCRIPT, LANG_INDEX_INSTR2); execute(SCI_SETKEYWORDS, 0, reinterpret_cast(jsInstrs)); execute(SCI_SETKEYWORDS, 1, reinterpret_cast(jsTypes)); @@ -1451,7 +1451,7 @@ void ScintillaEditView::setJsLexer() basic_string kwlW = pKwArray[LANG_INDEX_INSTR]; keywordListInstruction = wstring2string(kwlW, CP_ACP); } - const char *jsEmbeddedInstrs = getCompleteKeywordList(keywordListInstruction, L_JS_EMBEDDED, LANG_INDEX_INSTR); + const char *jsEmbeddedInstrs = concatToBuildKeywordList(keywordListInstruction, L_JS_EMBEDDED, LANG_INDEX_INSTR); execute(SCI_SETKEYWORDS, 0, reinterpret_cast(jsEmbeddedInstrs)); } @@ -1487,14 +1487,14 @@ void ScintillaEditView::setTclLexer() basic_string kwlW = pKwArray[LANG_INDEX_INSTR]; keywordListInstruction = wstring2string(kwlW, CP_ACP); } - tclInstrs = getCompleteKeywordList(keywordListInstruction, L_TCL, LANG_INDEX_INSTR); + tclInstrs = concatToBuildKeywordList(keywordListInstruction, L_TCL, LANG_INDEX_INSTR); if (pKwArray[LANG_INDEX_TYPE]) { basic_string kwlW = pKwArray[LANG_INDEX_TYPE]; keywordListType = wstring2string(kwlW, CP_ACP); } - tclTypes = getCompleteKeywordList(keywordListType, L_TCL, LANG_INDEX_TYPE); + tclTypes = concatToBuildKeywordList(keywordListType, L_TCL, LANG_INDEX_TYPE); execute(SCI_SETKEYWORDS, 0, reinterpret_cast(tclInstrs)); execute(SCI_SETKEYWORDS, 1, reinterpret_cast(tclTypes)); @@ -1513,21 +1513,21 @@ void ScintillaEditView::setObjCLexer(LangType langType) { objcInstr1Kwl = wstring2string(pKwArray[LANG_INDEX_INSTR], CP_ACP); } - const char *objcInstrs = getCompleteKeywordList(objcInstr1Kwl, langType, LANG_INDEX_INSTR); + const char *objcInstrs = concatToBuildKeywordList(objcInstr1Kwl, langType, LANG_INDEX_INSTR); basic_string objcInstr2Kwl(""); if (pKwArray[LANG_INDEX_INSTR2]) { objcInstr2Kwl = wstring2string(pKwArray[LANG_INDEX_INSTR2], CP_ACP); } - const char *objCDirective = getCompleteKeywordList(objcInstr2Kwl, langType, LANG_INDEX_INSTR2); + const char *objCDirective = concatToBuildKeywordList(objcInstr2Kwl, langType, LANG_INDEX_INSTR2); basic_string objcTypeKwl(""); if (pKwArray[LANG_INDEX_TYPE]) { objcTypeKwl = wstring2string(pKwArray[LANG_INDEX_TYPE], CP_ACP); } - const char *objcTypes = getCompleteKeywordList(objcTypeKwl, langType, LANG_INDEX_TYPE); + const char *objcTypes = concatToBuildKeywordList(objcTypeKwl, langType, LANG_INDEX_TYPE); basic_string objcType2Kwl(""); @@ -1535,7 +1535,7 @@ void ScintillaEditView::setObjCLexer(LangType langType) { objcType2Kwl = wstring2string(pKwArray[LANG_INDEX_TYPE2], CP_ACP); } - const char *objCQualifier = getCompleteKeywordList(objcType2Kwl, langType, LANG_INDEX_TYPE2); + const char *objCQualifier = concatToBuildKeywordList(objcType2Kwl, langType, LANG_INDEX_TYPE2); @@ -1587,10 +1587,10 @@ void ScintillaEditView::setTypeScriptLexer() }; std::string keywordListInstruction = getKeywordList(LANG_INDEX_INSTR); - const char* tsInstructions = getCompleteKeywordList(keywordListInstruction, L_TYPESCRIPT, LANG_INDEX_INSTR); + const char* tsInstructions = concatToBuildKeywordList(keywordListInstruction, L_TYPESCRIPT, LANG_INDEX_INSTR); string keywordListType = getKeywordList(LANG_INDEX_TYPE); - const char* tsTypes = getCompleteKeywordList(keywordListType, L_TYPESCRIPT, LANG_INDEX_TYPE); + const char* tsTypes = concatToBuildKeywordList(keywordListType, L_TYPESCRIPT, LANG_INDEX_TYPE); execute(SCI_SETKEYWORDS, 0, reinterpret_cast(tsInstructions)); execute(SCI_SETKEYWORDS, 1, reinterpret_cast(tsTypes)); @@ -1612,7 +1612,7 @@ void ScintillaEditView::setKeywords(LangType langType, const char *keywords, int { std::basic_string wordList; wordList = (keywords)?keywords:""; - execute(SCI_SETKEYWORDS, index, reinterpret_cast(getCompleteKeywordList(wordList, langType, index))); + execute(SCI_SETKEYWORDS, index, reinterpret_cast(concatToBuildKeywordList(wordList, langType, index))); } void ScintillaEditView::populateSubStyleKeywords(LangType langType, int baseStyleID, int numSubStyles, int firstLangIndex, const wchar_t **pKwArray) @@ -1627,7 +1627,7 @@ void ScintillaEditView::populateSubStyleKeywords(LangType langType, int baseStyl int ss = firstLangIndex + i; int styleID = firstID + i; basic_string userWords = pKwArray[ss] ? wmc.wchar2char(pKwArray[ss], CP_ACP) : ""; - execute(SCI_SETIDENTIFIERS, styleID, reinterpret_cast(getCompleteKeywordList(userWords, langType, ss))); + execute(SCI_SETIDENTIFIERS, styleID, reinterpret_cast(concatToBuildKeywordList(userWords, langType, ss))); } } } @@ -3678,7 +3678,7 @@ void ScintillaEditView::updateLineNumberWidth() } -const char * ScintillaEditView::getCompleteKeywordList(std::basic_string & kwl, LangType langType, int keywordIndex) +const char * ScintillaEditView::concatToBuildKeywordList(std::basic_string & kwl, LangType langType, int keywordIndex) { kwl += " "; const wchar_t* defKwl_generic = NppParameters::getInstance().getWordList(langType, keywordIndex); diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 60c805906..a16d6c707 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -703,7 +703,7 @@ protected: //Lexers and Styling void restyleBuffer(); - const char * getCompleteKeywordList(std::basic_string & kwl, LangType langType, int keywordIndex); + const char * concatToBuildKeywordList(std::basic_string & kwl, LangType langType, int keywordIndex); void setKeywords(LangType langType, const char *keywords, int index); void populateSubStyleKeywords(LangType langType, int baseStyleID, int numSubStyles, int firstLangIndex, const wchar_t **pKwArray); void setLexer(LangType langID, int whichList, int baseStyleID = STYLE_NOT_USED, int numSubStyles = 8);