|
|
@ -100,7 +100,7 @@ void Buffer::setFileName(const char *fn, LangType defaultLang)
|
|
|
|
_fileName = PathFindFileName(_fullPathName);
|
|
|
|
_fileName = PathFindFileName(_fullPathName);
|
|
|
|
|
|
|
|
|
|
|
|
// for _lang
|
|
|
|
// for _lang
|
|
|
|
_lang = defaultLang;
|
|
|
|
LangType newLang = defaultLang;
|
|
|
|
char *ext = PathFindExtension(_fullPathName);
|
|
|
|
char *ext = PathFindExtension(_fullPathName);
|
|
|
|
if (*ext == '.') { //extension found
|
|
|
|
if (*ext == '.') { //extension found
|
|
|
|
ext += 1;
|
|
|
|
ext += 1;
|
|
|
@ -109,27 +109,32 @@ void Buffer::setFileName(const char *fn, LangType defaultLang)
|
|
|
|
const char *langName = NULL;
|
|
|
|
const char *langName = NULL;
|
|
|
|
if ((langName = pNppParamInst->getUserDefinedLangNameFromExt(ext)))
|
|
|
|
if ((langName = pNppParamInst->getUserDefinedLangNameFromExt(ext)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_lang = L_USER;
|
|
|
|
newLang = L_USER;
|
|
|
|
strcpy(_userLangExt, langName);
|
|
|
|
strcpy(_userLangExt, langName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // if it's not user lang, then check if it's supported lang
|
|
|
|
else // if it's not user lang, then check if it's supported lang
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_userLangExt[0] = '\0';
|
|
|
|
_userLangExt[0] = '\0';
|
|
|
|
_lang = getLangFromExt(ext);
|
|
|
|
newLang = getLangFromExt(ext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_lang == defaultLang || _lang == L_TXT) //language can probably be refined
|
|
|
|
if (newLang == defaultLang || newLang == L_TXT) //language can probably be refined
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((!_stricmp(_fileName, "makefile")) || (!_stricmp(_fileName, "GNUmakefile")))
|
|
|
|
if ((!_stricmp(_fileName, "makefile")) || (!_stricmp(_fileName, "GNUmakefile")))
|
|
|
|
_lang = L_MAKEFILE;
|
|
|
|
newLang = L_MAKEFILE;
|
|
|
|
else if (!_stricmp(_fileName, "CmakeLists.txt"))
|
|
|
|
else if (!_stricmp(_fileName, "CmakeLists.txt"))
|
|
|
|
_lang = L_CMAKE;
|
|
|
|
newLang = L_CMAKE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
updateTimeStamp();
|
|
|
|
updateTimeStamp();
|
|
|
|
|
|
|
|
if (newLang != _lang) {
|
|
|
|
|
|
|
|
_lang = newLang;
|
|
|
|
|
|
|
|
doNotify(BufferChangeFilename | BufferChangeLanguage | BufferChangeTimestamp);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
doNotify(BufferChangeFilename | BufferChangeLanguage | BufferChangeTimestamp);
|
|
|
|
doNotify(BufferChangeFilename | BufferChangeTimestamp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Buffer::checkFileState() { //returns true if the status has been changed (it can change into DOC_REGULAR too). false otherwise
|
|
|
|
bool Buffer::checkFileState() { //returns true if the status has been changed (it can change into DOC_REGULAR too). false otherwise
|
|
|
|