Fix the crash regression due to the array size increase
LexerStylerArray contains a MAX_LEXER_STYLE-element array (currently 100) of LexerStyler objects. Every one of them in turn via inheritance from StyleArray contains a SCE_STYLE_ARRAY_SIZE-element array (I tested with 99) of Style objects each at least 56 bytes in size. This in my test case requires over 550k of memory, and if LexerStylerArray is allocated on stack, the stack becomes corrupted. (Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/10454#issuecomment-908732786) Inline arrays are a part of an object and increase its size while std::vector uses memory from the heap and stores internally only a pointer to a chunk of memory, thus the size of an object with a vector is substantially smaller than the one with an inline array. (Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/10454#issuecomment-908780106) Fix #10454, fix #10206
This commit is contained in:
parent
c1cce29c84
commit
88ee2eddb0
|
@ -926,7 +926,7 @@ bool NppParameters::reloadStylers(const TCHAR* stylePath)
|
|||
_pXmlUserStylerDoc = NULL;
|
||||
return false;
|
||||
}
|
||||
_lexerStylerArray.eraseAll();
|
||||
_lexerStylerVect.eraseAll();
|
||||
_widgetStyleArray.setNbStyler( 0 );
|
||||
|
||||
getUserStylersFromXmlTree();
|
||||
|
@ -2776,9 +2776,9 @@ std::pair<unsigned char, unsigned char> NppParameters::feedUserLang(TiXmlNode *n
|
|||
// styles that were not read from xml file should get default values
|
||||
for (int i=0; i<SCE_USER_STYLE_TOTAL_STYLES; ++i)
|
||||
{
|
||||
Style & style = _userLangArray[_nbUserLang - 1]->_styleArray.getStyler(i);
|
||||
Style & style = _userLangArray[_nbUserLang - 1]->_styles.getStyler(i);
|
||||
if (style._styleID == -1)
|
||||
_userLangArray[_nbUserLang - 1]->_styleArray.addStyler(i, globalMappper().styleNameMapper[i].c_str());
|
||||
_userLangArray[_nbUserLang - 1]->_styles.addStyler(i, globalMappper().styleNameMapper[i].c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3554,7 +3554,7 @@ void NppParameters::feedUserStyles(TiXmlNode *node)
|
|||
if (globalMappper().styleIdMapper.find(styleName) != globalMappper().styleIdMapper.end())
|
||||
{
|
||||
id = globalMappper().styleIdMapper[styleName];
|
||||
_userLangArray[_nbUserLang - 1]->_styleArray.addStyler((id | L_USER << 16), childNode);
|
||||
_userLangArray[_nbUserLang - 1]->_styles.addStyler((id | L_USER << 16), childNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3570,7 +3570,7 @@ bool NppParameters::feedStylerArray(TiXmlNode *node)
|
|||
childNode ;
|
||||
childNode = childNode->NextSibling(TEXT("LexerType")) )
|
||||
{
|
||||
if (!_lexerStylerArray.hasEnoughSpace()) return false;
|
||||
if (!_lexerStylerVect.hasEnoughSpace()) return false;
|
||||
|
||||
TiXmlElement *element = childNode->ToElement();
|
||||
const TCHAR *lexerName = element->Attribute(TEXT("name"));
|
||||
|
@ -3579,7 +3579,7 @@ bool NppParameters::feedStylerArray(TiXmlNode *node)
|
|||
const TCHAR *lexerExcluded = element->Attribute(TEXT("excluded"));
|
||||
if (lexerName)
|
||||
{
|
||||
_lexerStylerArray.addLexerStyler(lexerName, lexerDesc, lexerUserExt, childNode);
|
||||
_lexerStylerVect.addLexerStyler(lexerName, lexerDesc, lexerUserExt, childNode);
|
||||
if (lexerExcluded != NULL && (lstrcmp(lexerExcluded, TEXT("yes")) == 0))
|
||||
{
|
||||
int index = getExternalLangIndexFromName(lexerName);
|
||||
|
@ -3613,7 +3613,7 @@ bool NppParameters::feedStylerArray(TiXmlNode *node)
|
|||
|
||||
void LexerStylerArray::addLexerStyler(const TCHAR *lexerName, const TCHAR *lexerDesc, const TCHAR *lexerUserExt , TiXmlNode *lexerNode)
|
||||
{
|
||||
LexerStyler & ls = _lexerStylerArray[_nbLexerStyler++];
|
||||
LexerStyler & ls = _lexerStylerVect[_nbLexerStyler++];
|
||||
ls.setLexerName(lexerName);
|
||||
if (lexerDesc)
|
||||
ls.setLexerDesc(lexerDesc);
|
||||
|
@ -3647,7 +3647,7 @@ void LexerStylerArray::eraseAll()
|
|||
|
||||
for (int i = 0 ; i < _nbLexerStyler ; ++i)
|
||||
{
|
||||
_lexerStylerArray[i].setNbStyler( 0 );
|
||||
_lexerStylerVect[i].setNbStyler( 0 );
|
||||
}
|
||||
|
||||
_nbLexerStyler = 0;
|
||||
|
@ -3661,11 +3661,16 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
|
|||
{
|
||||
styleID = (styleID & 0xFFFF);
|
||||
index = styleID;
|
||||
if (index >= SCE_USER_STYLE_TOTAL_STYLES || _styleArray[index]._styleID != -1)
|
||||
if (index >= SCE_USER_STYLE_TOTAL_STYLES || _styleVect[index]._styleID != -1)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index >= STYLE_ARR_MAX_SIZE)
|
||||
return;
|
||||
}
|
||||
|
||||
_styleArray[index]._styleID = styleID;
|
||||
_styleVect[index]._styleID = styleID;
|
||||
|
||||
if (styleNode)
|
||||
{
|
||||
|
@ -3679,16 +3684,16 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
|
|||
if (str)
|
||||
{
|
||||
if (isUser)
|
||||
_styleArray[index]._styleDesc = globalMappper().styleNameMapper[index].c_str();
|
||||
_styleVect[index]._styleDesc = globalMappper().styleNameMapper[index].c_str();
|
||||
else
|
||||
_styleArray[index]._styleDesc = str;
|
||||
_styleVect[index]._styleDesc = str;
|
||||
}
|
||||
|
||||
str = element->Attribute(TEXT("fgColor"));
|
||||
if (str)
|
||||
{
|
||||
unsigned long result = hexStrVal(str);
|
||||
_styleArray[index]._fgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000);
|
||||
_styleVect[index]._fgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000);
|
||||
|
||||
}
|
||||
|
||||
|
@ -3696,46 +3701,46 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
|
|||
if (str)
|
||||
{
|
||||
unsigned long result = hexStrVal(str);
|
||||
_styleArray[index]._bgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000);
|
||||
_styleVect[index]._bgColor = (RGB((result >> 16) & 0xFF, (result >> 8) & 0xFF, result & 0xFF)) | (result & 0xFF000000);
|
||||
}
|
||||
|
||||
str = element->Attribute(TEXT("colorStyle"));
|
||||
if (str)
|
||||
{
|
||||
_styleArray[index]._colorStyle = decStrVal(str);
|
||||
_styleVect[index]._colorStyle = decStrVal(str);
|
||||
}
|
||||
|
||||
str = element->Attribute(TEXT("fontName"));
|
||||
_styleArray[index]._fontName = str;
|
||||
_styleVect[index]._fontName = str;
|
||||
|
||||
str = element->Attribute(TEXT("fontStyle"));
|
||||
if (str)
|
||||
{
|
||||
_styleArray[index]._fontStyle = decStrVal(str);
|
||||
_styleVect[index]._fontStyle = decStrVal(str);
|
||||
}
|
||||
|
||||
str = element->Attribute(TEXT("fontSize"));
|
||||
if (str)
|
||||
{
|
||||
_styleArray[index]._fontSize = decStrVal(str);
|
||||
_styleVect[index]._fontSize = decStrVal(str);
|
||||
}
|
||||
str = element->Attribute(TEXT("nesting"));
|
||||
|
||||
if (str)
|
||||
{
|
||||
_styleArray[index]._nesting = decStrVal(str);
|
||||
_styleVect[index]._nesting = decStrVal(str);
|
||||
}
|
||||
|
||||
str = element->Attribute(TEXT("keywordClass"));
|
||||
if (str)
|
||||
{
|
||||
_styleArray[index]._keywordClass = getKwClassFromName(str);
|
||||
_styleVect[index]._keywordClass = getKwClassFromName(str);
|
||||
}
|
||||
|
||||
TiXmlNode *v = styleNode->FirstChild();
|
||||
if (v)
|
||||
{
|
||||
_styleArray[index]._keywords = new generic_string(v->Value());
|
||||
_styleVect[index]._keywords = new generic_string(v->Value());
|
||||
}
|
||||
}
|
||||
++_nbStyler;
|
||||
|
@ -7071,7 +7076,7 @@ generic_string NppParameters::writeStyles(LexerStylerArray & lexersStylers, Styl
|
|||
TiXmlElement *element = childNode->ToElement();
|
||||
const TCHAR *nm = element->Attribute(TEXT("name"));
|
||||
|
||||
LexerStyler *pLs = _lexerStylerArray.getLexerStylerByName(nm);
|
||||
LexerStyler *pLs = _lexerStylerVect.getLexerStylerByName(nm);
|
||||
LexerStyler *pLs2 = lexersStylers.getLexerStylerByName(nm);
|
||||
|
||||
if (pLs)
|
||||
|
@ -7107,7 +7112,7 @@ generic_string NppParameters::writeStyles(LexerStylerArray & lexersStylers, Styl
|
|||
TiXmlElement *element = childNode->ToElement();
|
||||
const TCHAR *nm = element->Attribute(TEXT("name"));
|
||||
|
||||
LexerStyler *pLs = _lexerStylerArray.getLexerStylerByName(nm);
|
||||
LexerStyler *pLs = _lexerStylerVect.getLexerStylerByName(nm);
|
||||
LexerStyler *pLs2 = lexersStylers.getLexerStylerByName(nm);
|
||||
|
||||
if (pLs)
|
||||
|
@ -7289,7 +7294,7 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user
|
|||
for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; ++i)
|
||||
{
|
||||
TiXmlElement *styleElement = (styleRootElement->InsertEndChild(TiXmlElement(TEXT("WordsStyle"))))->ToElement();
|
||||
Style style2Write = userLang->_styleArray.getStyler(i);
|
||||
Style style2Write = userLang->_styles.getStyler(i);
|
||||
|
||||
if (style2Write._styleID == -1)
|
||||
continue;
|
||||
|
@ -7349,7 +7354,7 @@ void NppParameters::stylerStrOp(bool op)
|
|||
{
|
||||
for (int j = 0 ; j < SCE_USER_STYLE_TOTAL_STYLES ; ++j)
|
||||
{
|
||||
Style & style = _userLangArray[i]->_styleArray.getStyler(j);
|
||||
Style & style = _userLangArray[i]->_styles.getStyler(j);
|
||||
|
||||
if (op == DUP)
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
class NativeLangSpeaker;
|
||||
|
||||
const bool POS_VERTICAL = true;
|
||||
|
@ -469,6 +470,7 @@ struct GlobalOverride final
|
|||
bool enableUnderLine = false;
|
||||
};
|
||||
|
||||
const int STYLE_ARR_MAX_SIZE = 31;
|
||||
|
||||
struct StyleArray
|
||||
{
|
||||
|
@ -480,7 +482,7 @@ public:
|
|||
this->_nbStyler = sa._nbStyler;
|
||||
for (int i = 0 ; i < _nbStyler ; ++i)
|
||||
{
|
||||
this->_styleArray[i] = sa._styleArray[i];
|
||||
this->_styleVect[i] = sa._styleVect[i];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
|
@ -491,19 +493,19 @@ public:
|
|||
|
||||
Style& getStyler(size_t index)
|
||||
{
|
||||
assert(index < SCE_STYLE_ARRAY_SIZE);
|
||||
return _styleArray[index];
|
||||
assert(index < STYLE_ARR_MAX_SIZE);
|
||||
return _styleVect[index];
|
||||
}
|
||||
|
||||
bool hasEnoughSpace() {return (_nbStyler < SCE_STYLE_ARRAY_SIZE);};
|
||||
bool hasEnoughSpace() {return (_nbStyler < STYLE_ARR_MAX_SIZE);};
|
||||
void addStyler(int styleID, TiXmlNode *styleNode);
|
||||
|
||||
void addStyler(int styleID, const TCHAR *styleName)
|
||||
{
|
||||
_styleArray[styleID]._styleID = styleID;
|
||||
_styleArray[styleID]._styleDesc = styleName;
|
||||
_styleArray[styleID]._fgColor = black;
|
||||
_styleArray[styleID]._bgColor = white;
|
||||
_styleVect[styleID]._styleID = styleID;
|
||||
_styleVect[styleID]._styleDesc = styleName;
|
||||
_styleVect[styleID]._fgColor = black;
|
||||
_styleVect[styleID]._bgColor = white;
|
||||
++_nbStyler;
|
||||
}
|
||||
|
||||
|
@ -511,7 +513,7 @@ public:
|
|||
{
|
||||
for (int i = 0 ; i < _nbStyler ; ++i)
|
||||
{
|
||||
if (_styleArray[i]._styleID == id)
|
||||
if (_styleVect[i]._styleID == id)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
@ -523,14 +525,14 @@ public:
|
|||
return -1;
|
||||
for (int i = 0 ; i < _nbStyler ; ++i)
|
||||
{
|
||||
if (!lstrcmp(_styleArray[i]._styleDesc, name))
|
||||
if (!lstrcmp(_styleVect[i]._styleDesc, name))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected:
|
||||
Style _styleArray[SCE_STYLE_ARRAY_SIZE];
|
||||
std::vector<Style> _styleVect = std::vector<Style>(STYLE_ARR_MAX_SIZE);
|
||||
int _nbStyler = 0;
|
||||
};
|
||||
|
||||
|
@ -590,7 +592,7 @@ public :
|
|||
{
|
||||
this->_nbLexerStyler = lsa._nbLexerStyler;
|
||||
for (int i = 0 ; i < this->_nbLexerStyler ; ++i)
|
||||
this->_lexerStylerArray[i] = lsa._lexerStylerArray[i];
|
||||
this->_lexerStylerVect[i] = lsa._lexerStylerVect[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -599,18 +601,18 @@ public :
|
|||
|
||||
LexerStyler & getLexerFromIndex(int index)
|
||||
{
|
||||
return _lexerStylerArray[index];
|
||||
return _lexerStylerVect[index];
|
||||
};
|
||||
|
||||
const TCHAR * getLexerNameFromIndex(int index) const {return _lexerStylerArray[index].getLexerName();}
|
||||
const TCHAR * getLexerDescFromIndex(int index) const {return _lexerStylerArray[index].getLexerDesc();}
|
||||
const TCHAR * getLexerNameFromIndex(int index) const {return _lexerStylerVect[index].getLexerName();}
|
||||
const TCHAR * getLexerDescFromIndex(int index) const {return _lexerStylerVect[index].getLexerDesc();}
|
||||
|
||||
LexerStyler * getLexerStylerByName(const TCHAR *lexerName) {
|
||||
if (!lexerName) return NULL;
|
||||
for (int i = 0 ; i < _nbLexerStyler ; ++i)
|
||||
{
|
||||
if (!lstrcmp(_lexerStylerArray[i].getLexerName(), lexerName))
|
||||
return &(_lexerStylerArray[i]);
|
||||
if (!lstrcmp(_lexerStylerVect[i].getLexerName(), lexerName))
|
||||
return &(_lexerStylerVect[i]);
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
@ -618,7 +620,7 @@ public :
|
|||
void addLexerStyler(const TCHAR *lexerName, const TCHAR *lexerDesc, const TCHAR *lexerUserExt, TiXmlNode *lexerNode);
|
||||
void eraseAll();
|
||||
private :
|
||||
LexerStyler _lexerStylerArray[MAX_LEXER_STYLE];
|
||||
std::vector<LexerStyler> _lexerStylerVect = std::vector<LexerStyler>(MAX_LEXER_STYLE);
|
||||
int _nbLexerStyler;
|
||||
};
|
||||
|
||||
|
@ -1100,15 +1102,15 @@ public:
|
|||
this->_isDarkModeTheme = ulc._isDarkModeTheme;
|
||||
this->_udlVersion = ulc._udlVersion;
|
||||
this->_isCaseIgnored = ulc._isCaseIgnored;
|
||||
this->_styleArray = ulc._styleArray;
|
||||
this->_styles = ulc._styles;
|
||||
this->_allowFoldOfComments = ulc._allowFoldOfComments;
|
||||
this->_forcePureLC = ulc._forcePureLC;
|
||||
this->_decimalSeparator = ulc._decimalSeparator;
|
||||
this->_foldCompact = ulc._foldCompact;
|
||||
int nbStyler = this->_styleArray.getNbStyler();
|
||||
int nbStyler = this->_styles.getNbStyler();
|
||||
for (int i = 0 ; i < nbStyler ; ++i)
|
||||
{
|
||||
Style & st = this->_styleArray.getStyler(i);
|
||||
Style & st = this->_styles.getStyler(i);
|
||||
if (st._bgColor == COLORREF(-1))
|
||||
st._bgColor = white;
|
||||
if (st._fgColor == COLORREF(-1))
|
||||
|
@ -1129,7 +1131,7 @@ public:
|
|||
const TCHAR * getUdlVersion() {return _udlVersion.c_str();};
|
||||
|
||||
private:
|
||||
StyleArray _styleArray;
|
||||
StyleArray _styles;
|
||||
generic_string _name;
|
||||
generic_string _ext;
|
||||
generic_string _udlVersion;
|
||||
|
@ -1498,7 +1500,7 @@ public:
|
|||
generic_string writeStyles(LexerStylerArray & lexersStylers, StyleArray & globalStylers); // return "" if saving file succeeds, otherwise return the new saved file path
|
||||
bool insertTabInfo(const TCHAR *langName, int tabInfo);
|
||||
|
||||
LexerStylerArray & getLStylerArray() {return _lexerStylerArray;};
|
||||
LexerStylerArray & getLStylerArray() {return _lexerStylerVect;};
|
||||
StyleArray & getGlobalStylers() {return _widgetStyleArray;};
|
||||
|
||||
StyleArray & getMiscStylerArray() {return _widgetStyleArray;};
|
||||
|
@ -1820,7 +1822,7 @@ private:
|
|||
int _fileSaveDlgFilterIndex = -1;
|
||||
|
||||
// All Styles (colours & fonts)
|
||||
LexerStylerArray _lexerStylerArray;
|
||||
LexerStylerArray _lexerStylerVect;
|
||||
StyleArray _widgetStyleArray;
|
||||
|
||||
std::vector<generic_string> _fontlist;
|
||||
|
|
|
@ -866,7 +866,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
|
|||
|
||||
for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; ++i)
|
||||
{
|
||||
Style & style = userLangContainer->_styleArray.getStyler(i);
|
||||
Style & style = userLangContainer->_styles.getStyler(i);
|
||||
|
||||
if (style._styleID == STYLE_NOT_USED)
|
||||
continue;
|
||||
|
|
|
@ -865,30 +865,30 @@ UserDefineDialog::UserDefineDialog(): SharedParametersDialog()
|
|||
{
|
||||
_pCurrentUserLang = new UserLangContainer();
|
||||
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DEFAULT, globalMappper().styleNameMapper[SCE_USER_STYLE_DEFAULT].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_COMMENT, globalMappper().styleNameMapper[SCE_USER_STYLE_COMMENT].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_COMMENTLINE, globalMappper().styleNameMapper[SCE_USER_STYLE_COMMENTLINE].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_NUMBER, globalMappper().styleNameMapper[SCE_USER_STYLE_NUMBER].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD1, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD1].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD2, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD2].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD3, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD3].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD4, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD4].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD5, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD5].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD6, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD6].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD7, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD7].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_KEYWORD8, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD8].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_OPERATOR, globalMappper().styleNameMapper[SCE_USER_STYLE_OPERATOR].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_CODE1, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_CODE1].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_CODE2, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_CODE2].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_FOLDER_IN_COMMENT, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_COMMENT].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER1, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER1].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER2, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER2].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER3, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER3].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER4, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER4].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER5, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER5].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER6, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER6].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER7, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER7].c_str());
|
||||
_pCurrentUserLang->_styleArray.addStyler(SCE_USER_STYLE_DELIMITER8, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER8].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DEFAULT, globalMappper().styleNameMapper[SCE_USER_STYLE_DEFAULT].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_COMMENT, globalMappper().styleNameMapper[SCE_USER_STYLE_COMMENT].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_COMMENTLINE, globalMappper().styleNameMapper[SCE_USER_STYLE_COMMENTLINE].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_NUMBER, globalMappper().styleNameMapper[SCE_USER_STYLE_NUMBER].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_KEYWORD1, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD1].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_KEYWORD2, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD2].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_KEYWORD3, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD3].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_KEYWORD4, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD4].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_KEYWORD5, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD5].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_KEYWORD6, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD6].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_KEYWORD7, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD7].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_KEYWORD8, globalMappper().styleNameMapper[SCE_USER_STYLE_KEYWORD8].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_OPERATOR, globalMappper().styleNameMapper[SCE_USER_STYLE_OPERATOR].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_FOLDER_IN_CODE1, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_CODE1].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_FOLDER_IN_CODE2, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_CODE2].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_FOLDER_IN_COMMENT, globalMappper().styleNameMapper[SCE_USER_STYLE_FOLDER_IN_COMMENT].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DELIMITER1, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER1].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DELIMITER2, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER2].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DELIMITER3, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER3].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DELIMITER4, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER4].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DELIMITER5, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER5].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DELIMITER6, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER6].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DELIMITER7, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER7].c_str());
|
||||
_pCurrentUserLang->_styles.addStyler(SCE_USER_STYLE_DELIMITER8, globalMappper().styleNameMapper[SCE_USER_STYLE_DELIMITER8].c_str());
|
||||
}
|
||||
|
||||
UserDefineDialog::~UserDefineDialog()
|
||||
|
@ -1726,7 +1726,7 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
|
||||
::SetProp(hwnd, TEXT("Styler dialog prop"), (HANDLE)lParam);
|
||||
dlg = (StylerDlg *)::GetProp(hwnd, TEXT("Styler dialog prop"));
|
||||
Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->_stylerIndex);
|
||||
Style & style = SharedParametersDialog::_pUserLang->_styles.getStyler(dlg->_stylerIndex);
|
||||
|
||||
// move dialog over UDL GUI (position 0,0 of UDL window) so it wouldn't cover the code
|
||||
RECT wrc;
|
||||
|
@ -1848,7 +1848,7 @@ INT_PTR CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
|||
if (dlg == nullptr)
|
||||
return FALSE;
|
||||
|
||||
Style & style = SharedParametersDialog::_pUserLang->_styleArray.getStyler(dlg->_stylerIndex);
|
||||
Style & style = SharedParametersDialog::_pUserLang->_styles.getStyler(dlg->_stylerIndex);
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
auto i = ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETCURSEL, 0, 0);
|
||||
|
|
|
@ -433,7 +433,7 @@ public:
|
|||
_hInst(hInst), _parent(parent), _stylerIndex(stylerIndex), _enabledNesters(enabledNesters) {
|
||||
_pFgColour = new ColourPicker;
|
||||
_pBgColour = new ColourPicker;
|
||||
_initialStyle = SharedParametersDialog::_pUserLang->_styleArray.getStyler(stylerIndex);
|
||||
_initialStyle = SharedParametersDialog::_pUserLang->_styles.getStyler(stylerIndex);
|
||||
};
|
||||
|
||||
~StylerDlg() {
|
||||
|
|
|
@ -229,7 +229,6 @@
|
|||
#define SCE_USER_STYLE_IDENTIFIER 24
|
||||
#define SCE_USER_STYLE_TOTAL_STYLES SCE_USER_STYLE_IDENTIFIER
|
||||
#define SCE_USER_STYLE_MAPPER_TOTAL 17
|
||||
#define SCE_STYLE_ARRAY_SIZE 38 // must cover sizes of NppParameters::_lexerStyler
|
||||
|
||||
#define SCE_USER_MASK_NESTING_NONE 0
|
||||
#define SCE_USER_MASK_NESTING_DELIMITER1 0x1
|
||||
|
|
Loading…
Reference in New Issue