+ fix: move hardcoded lexer <-> filename (w/o .ext) associations to configurable scheme (regex def)

This commit is contained in:
Rainer Kottenhoff 2020-02-29 04:21:47 +01:00
parent cf516bb4d7
commit b99af625cf
10 changed files with 20 additions and 60 deletions

View File

@ -1 +1 @@
1
2

View File

@ -3,7 +3,7 @@
<assemblyIdentity
name="Notepad3"
processorArchitecture="*"
version="5.20.229.1"
version="5.20.229.2"
type="win32"
/>
<description>Notepad3 RC2</description>

View File

@ -20,7 +20,7 @@ NULL,
EDITLEXER lexBASH = {
SCLEX_BASH, IDS_LEX_SHELL_SCR, L"Shell Script", L"sh; csh; zsh; bash; tcsh; m4; in", L"",
SCLEX_BASH, IDS_LEX_SHELL_SCR, L"Shell Script", L"sh; csh; zsh; bash; tcsh; m4; in; \\mozconfig", L"",
&KeyWords_BASH, {
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
//{ {SCE_SH_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },

View File

@ -33,7 +33,7 @@ NULL,
EDITLEXER lexCmake = {
SCLEX_CMAKE, IDS_LEX_CMAKE, L"Cmake Script", L"cmake; ctest", L"",
SCLEX_CMAKE, IDS_LEX_CMAKE, L"Cmake Script", L"cmake; ctest; \\cmakelists\\.txt", L"",
&KeyWords_CMAKE, {
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
//{ {SCE_CMAKE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },

View File

@ -125,7 +125,7 @@ NULL,
EDITLEXER lexCONF = {
SCLEX_CONF, IDS_LEX_APC_CFG, L"Apache Config Files", L"conf; cfg; cnf; htaccess; prefs; iface; prop; po; te", L"",
SCLEX_CONF, IDS_LEX_APC_CFG, L"Apache Config Files", L"conf; cfg; cnf; htaccess; prefs; iface; prop; po; te; \\Kconfig; \\Doxyfile", L"",
&KeyWords_CONF, {
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
//{ {SCE_CONF_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },

View File

@ -5,7 +5,7 @@
KEYWORDLIST KeyWords_MAK = EMPTY_KEYWORDLIST;
EDITLEXER lexMAK = {
SCLEX_MAKEFILE, IDS_LEX_MAKEFILES, L"Makefiles", L"mak; make; mk; dsp; msc; msvc; am; pro; pri; gmk; ninja; dsw", L"",
SCLEX_MAKEFILE, IDS_LEX_MAKEFILES, L"Makefiles", L"mak; make; mk; dsp; msc; msvc; am; pro; pri; gmk; ninja; dsw; \\Makefile; \\Kbuild", L"",
&KeyWords_MAK, {
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
//{ {SCE_MAKE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },

View File

@ -9,7 +9,7 @@ NULL,
};
EDITLEXER lexRUBY = {
SCLEX_RUBY, IDS_LEX_RUBY, L"Ruby Script", L"rb; ruby; rbw; rake; rjs; rakefile; gemspec; podspec", L"",
SCLEX_RUBY, IDS_LEX_RUBY, L"Ruby Script", L"rb; ruby; rbw; rake; rjs; rakefile; gemspec; podspec; \\Rakefile; \\Podfile", L"",
&KeyWords_RUBY, {
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
//{ {SCE_RB_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },

View File

@ -60,7 +60,7 @@ SCLEX_NULL, IDS_LEX_TEXT_FILES, L"Text Files", L"txt; text; tmp; log; asc; doc;
EDITLEXER lexANSI = {
SCLEX_NULL, IDS_LEX_ANSI_ART, L"ANSI Art", L"nfo; diz", L"",
SCLEX_NULL, IDS_LEX_ANSI_ART, L"ANSI Art", L"nfo; diz; \\Readme", L"",
&KeyWords_NULL,{
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"font:Lucida Console; size:11; thin; smoothing:none", L"" },
{ {STYLE_LINENUMBER}, IDS_LEX_STD_MARGIN, L"Margins and Line Numbers", L"font:Lucida Console; size:-2", L"" },

View File

@ -2016,10 +2016,18 @@ bool Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile)
LPCWSTR lpszFileName = PathFindFileName(lpszFile);
if (!bFound && s_bAutoSelect && /* s_bAutoSelect == false skips lexer search */
(StrIsNotEmpty(lpszFile) && *lpszExt))
// check for filename regex match
if (!bFound && s_bAutoSelect && StrIsNotEmpty(lpszFile)) {
pLexSniffed = Style_RegExMatchLexer(lpszFileName);
if (pLexSniffed) {
pLexNew = pLexSniffed;
bFound = true;
}
}
if (!bFound && s_bAutoSelect && (StrIsNotEmpty(lpszFile) && *lpszExt))
{
if (*lpszExt == L'.') ++lpszExt;
if (*lpszExt == L'.') { ++lpszExt; }
if (!Flags.NoCGIGuess && (StringCchCompareXI(lpszExt,L"cgi") == 0 || StringCchCompareXI(lpszExt,L"fcgi") == 0)) {
char tchText[256] = { '\0' };
@ -2032,11 +2040,6 @@ bool Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile)
}
}
if (!bFound && StringCchCompareXI(lpszFileName,L"cmakelists.txt") == 0) {
pLexNew = &lexCmake;
bFound = true;
}
// check associated extensions
if (!bFound) {
pLexSniffed = Style_MatchLexer(lpszExt, false);
@ -2045,49 +2048,6 @@ bool Style_SetLexerFromFile(HWND hwnd,LPCWSTR lpszFile)
bFound = true;
}
}
// check for filename regex match
if (!bFound) {
pLexSniffed = Style_RegExMatchLexer(lpszFileName);
if (pLexSniffed) {
pLexNew = pLexSniffed;
bFound = true;
}
}
}
if (!bFound && s_bAutoSelect && lpszFile &&
StringCchCompareXI(lpszFileName, L"Readme") == 0) {
pLexNew = &lexANSI;
bFound = true;
}
if (!bFound && s_bAutoSelect && lpszFile &&
((StringCchCompareXI(lpszFileName,L"Makefile") == 0) ||
(StringCchCompareXI(lpszFileName, L"Kbuild") == 0))) {
pLexNew = &lexMAK;
bFound = true;
}
if (!bFound && s_bAutoSelect && lpszFile &&
((StringCchCompareXI(lpszFileName,L"Rakefile") == 0) ||
(StringCchCompareXI(lpszFileName, L"Podfile") == 0))) {
pLexNew = &lexRUBY;
bFound = true;
}
if (!bFound && s_bAutoSelect && lpszFile &&
StringCchCompareXI(lpszFileName,L"mozconfig") == 0) {
pLexNew = &lexBASH;
bFound = true;
}
if (!bFound && s_bAutoSelect && lpszFile &&
((StringCchCompareXI(lpszFileName, L"Kconfig") == 0) ||
(StringCchCompareXI(lpszFileName, L"Doxyfile") == 0))) {
pLexNew = &lexCONF;
bFound = true;
}
if (!bFound && s_bAutoSelect && (!Flags.NoHTMLGuess || !Flags.NoCGIGuess)) {

View File

@ -9,7 +9,7 @@
#define VERSION_MAJOR 5
#define VERSION_MINOR 20
#define VERSION_REV 229
#define VERSION_BUILD 1
#define VERSION_BUILD 2
#define SCINTILLA_VER 430
#define ONIGURUMA_REGEX_VER 6.9.4
#define UCHARDET_VER 2018.09.27