diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index 3f2c61f38..97dbe1173 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -1361,7 +1361,7 @@ public: std::unique_ptr Layout(const IScreenLine *screenLine) override; - void DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageDraw, UINT fuOptions); + void DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions); void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override; void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override; @@ -2310,10 +2310,11 @@ std::unique_ptr SurfaceD2D::Layout(const IScreenLine *screenL return std::make_unique(screenLine); } -void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageDraw, UINT fuOptions) { +void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions) { SetFont(font_); // Use Unicode calls + const int codePageDraw = codePageOverride ? codePageOverride : codePageText; const TextWide tbuf(text, codePageDraw); if (pRenderTarget && pTextFormat && pBrush) { if (fuOptions & ETO_CLIPPED) { @@ -2347,7 +2348,7 @@ void SurfaceD2D::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION yba if (pRenderTarget) { FillRectangleAligned(rc, back); D2DPenColourAlpha(fore); - DrawTextCommon(rc, font_, ybase, text, codePageText, ETO_OPAQUE); + DrawTextCommon(rc, font_, ybase, text, 0, ETO_OPAQUE); } } @@ -2356,7 +2357,7 @@ void SurfaceD2D::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION yb if (pRenderTarget) { FillRectangleAligned(rc, back); D2DPenColourAlpha(fore); - DrawTextCommon(rc, font_, ybase, text, codePageText, ETO_OPAQUE | ETO_CLIPPED); + DrawTextCommon(rc, font_, ybase, text, 0, ETO_OPAQUE | ETO_CLIPPED); } } @@ -2367,7 +2368,7 @@ void SurfaceD2D::DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITIO if (ch != ' ') { if (pRenderTarget) { D2DPenColourAlpha(fore); - DrawTextCommon(rc, font_, ybase, text, codePageText, 0); + DrawTextCommon(rc, font_, ybase, text, 0, 0); } return; } diff --git a/src/Edit.c b/src/Edit.c index ec5946dbf..a94c9e455 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -30,7 +30,6 @@ #include "crypto/crypto.h" #include "uthash/utarray.h" #include "uthash/utlist.h" -//#include "uthash/utstring.h" #include "tinyexpr/tinyexpr.h" #include "Encoding.h" #include "MuiLanguage.h" @@ -39,7 +38,6 @@ #include "DarkMode/DarkMode.h" #include "SciCall.h" -//#include "SciLexer.h" #include "Edit.h" @@ -7898,9 +7896,9 @@ void EditFoldMarkedLineRange(HWND hwnd, bool bHideLines) if (!bHideLines) { // reset SciCall_FoldAll(EXPAND); - Style_SetFoldingAvailability(Style_GetCurrentLexerPtr()); + Lexer_SetFoldingAvailability(Style_GetCurrentLexerPtr()); FocusedView.ShowCodeFolding = Settings.ShowCodeFolding; - Style_SetFoldingProperties(FocusedView.CodeFoldingAvailable); + Lexer_SetFoldingProperties(FocusedView.CodeFoldingAvailable); Style_SetFolding(hwnd, FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding); Sci_ColouriseAll(); EditMarkAllOccurrences(hwnd, true); @@ -7908,7 +7906,7 @@ void EditFoldMarkedLineRange(HWND hwnd, bool bHideLines) // prepare hidden (folding) settings FocusedView.CodeFoldingAvailable = true; FocusedView.ShowCodeFolding = true; - Style_SetFoldingFocusedView(); + Lexer_SetFoldingFocusedView(); Style_SetFolding(hwnd, true); int const baseLevel = SC_FOLDLEVELBASE; diff --git a/src/Notepad3.c b/src/Notepad3.c index e307645a3..29b41a1d2 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -41,8 +41,7 @@ #include "Notepad3.h" #include "Config/Config.h" #include "DarkMode/DarkMode.h" - -#include "lexers_x/SciXLexer.h" +#include "StyleLexers/EditLexer.h" // ============================================================================ // @@ -3460,153 +3459,6 @@ LRESULT MsgExitMenuLoop(HWND hwnd, WPARAM wParam) } -static void _GetStreamCommentStrgs(LPWSTR beg_out, LPWSTR end_out, size_t maxlen) -{ - - if (beg_out && end_out && maxlen) { - - switch (SciCall_GetLexer()) { - case SCLEX_AVS: - case SCLEX_CPP: - case SCLEX_CSS: - case SCLEX_D: // L"/+", L"+/" could also be used instead - case SCLEX_DART: - case SCLEX_HTML: - case SCLEX_JSON: - case SCLEX_KOTLIN: - case SCLEX_NSIS: - case SCLEX_RUST: - case SCLEX_SQL: - case SCLEX_VHDL: - case SCLEX_XML: - StringCchCopy(beg_out, maxlen, L"/*"); - StringCchCopy(end_out, maxlen, L"*/"); - break; - case SCLEX_INNOSETUP: - case SCLEX_PASCAL: - StringCchCopy(beg_out, maxlen, L"{"); - StringCchCopy(end_out, maxlen, L"}"); - break; - case SCLEX_LUA: - StringCchCopy(beg_out, maxlen, L"--[["); - StringCchCopy(end_out, maxlen, L"]]"); - break; - case SCLEX_COFFEESCRIPT: - StringCchCopy(beg_out, maxlen, L"###"); - StringCchCopy(end_out, maxlen, L"###"); - break; - case SCLEX_MATLAB: - StringCchCopy(beg_out, maxlen, L"%{"); - StringCchCopy(end_out, maxlen, L"%}"); - break; - // ------------------ - case SCLEX_NULL: - case SCLEX_AHKL: - case SCLEX_ASM: - case SCLEX_AU3: - case SCLEX_BASH: - case SCLEX_BATCH: - case SCLEX_CMAKE: - case SCLEX_CONF: - case SCLEX_DIFF: - case SCLEX_LATEX: - case SCLEX_MAKEFILE: - case SCLEX_MARKDOWN: - case SCLEX_NIM: - case SCLEX_PERL: - case SCLEX_POWERSHELL: - case SCLEX_PROPERTIES: - case SCLEX_PYTHON: - case SCLEX_R: - case SCLEX_REGISTRY: - case SCLEX_RUBY: - case SCLEX_TCL: - case SCLEX_TOML: - case SCLEX_VB: - case SCLEX_VBSCRIPT: - case SCLEX_YAML: - default: - StringCchCopy(beg_out, maxlen, L""); - StringCchCopy(end_out, maxlen, L""); - break; - } - } -} - - -static bool _GetLineCommentStrg(LPWSTR pre_out, size_t maxlen) -{ - if (pre_out && maxlen) { - - switch (SciCall_GetLexer()) { - case SCLEX_CPP: - case SCLEX_D: - case SCLEX_DART: - case SCLEX_HTML: - case SCLEX_JSON: - case SCLEX_KOTLIN: - case SCLEX_PASCAL: - case SCLEX_RUST: - case SCLEX_XML: - StringCchCopy(pre_out, maxlen, L"//"); - return false; - case SCLEX_VB: - case SCLEX_VBSCRIPT: - StringCchCopy(pre_out, maxlen, L"'"); - return false; - case SCLEX_AVS: - case SCLEX_BASH: - case SCLEX_CMAKE: - case SCLEX_COFFEESCRIPT: - case SCLEX_CONF: - case SCLEX_MAKEFILE: - case SCLEX_NIM: - case SCLEX_PERL: - case SCLEX_POWERSHELL: - case SCLEX_PYTHON: - case SCLEX_R: - case SCLEX_RUBY: - case SCLEX_TCL: - case SCLEX_TOML: - case SCLEX_YAML: - StringCchCopy(pre_out, maxlen, L"#"); - return true; - case SCLEX_AHKL: - case SCLEX_ASM: - case SCLEX_AU3: - case SCLEX_INNOSETUP: - case SCLEX_NSIS: // "#" could also be used instead - case SCLEX_PROPERTIES: - case SCLEX_REGISTRY: - StringCchCopy(pre_out, maxlen, L";"); - return true; - case SCLEX_LUA: - case SCLEX_SQL: - case SCLEX_VHDL: - StringCchCopy(pre_out, maxlen, L"--"); - return true; - case SCLEX_BATCH: // "::" could also be used instead - StringCchCopy(pre_out, maxlen, L"rem "); - return true; - case SCLEX_LATEX: - case SCLEX_MATLAB: - StringCchCopy(pre_out, maxlen, L"%"); - return true; - // ------------------ - case SCLEX_NULL: - case SCLEX_CSS: - case SCLEX_DIFF: - case SCLEX_MARKDOWN: - default: - StringCchCopy(pre_out, maxlen, L""); - break; - } - } - return false; -} - - - //============================================================================= // // MsgInitMenu() - Handles WM_INITMENU @@ -3792,10 +3644,10 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam) EnableCmd(hmenu, IDM_VIEW_SHOWEXCERPT, !se); WCHAR cmnt[8]; - _GetLineCommentStrg(cmnt, COUNTOF(cmnt)); + Lexer_GetLineCommentStrg(cmnt, COUNTOF(cmnt)); EnableCmd(hmenu, IDM_EDIT_LINECOMMENT, StrIsNotEmpty(cmnt) && !ro); - _GetStreamCommentStrgs(cmnt, cmnt, COUNTOF(cmnt)); + Lexer_GetStreamCommentStrgs(cmnt, cmnt, COUNTOF(cmnt)); EnableCmd(hmenu, IDM_EDIT_STREAMCOMMENT, StrIsNotEmpty(cmnt) && !ro); EnableCmd(hmenu, CMD_INSERTNEWLINE, !ro); @@ -4980,7 +4832,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_EDIT_LINECOMMENT: { WCHAR comment[8] = { L'\0' }; - bool const bAtStart = _GetLineCommentStrg(comment, COUNTOF(comment)); + bool const bAtStart = Lexer_GetLineCommentStrg(comment, COUNTOF(comment)); if (StrIsNotEmpty(comment)) { EditToggleLineCommentsSimple(comment, bAtStart); } @@ -4990,7 +4842,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_EDIT_LINECOMMENT_BLOCKEDIT: { WCHAR comment[8] = { L'\0' }; - bool const bAtStart = _GetLineCommentStrg(comment, COUNTOF(comment)); + bool const bAtStart = Lexer_GetLineCommentStrg(comment, COUNTOF(comment)); if (StrIsNotEmpty(comment)) { EditToggleLineCommentsExtended(comment, bAtStart); } @@ -5001,7 +4853,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) case IDM_EDIT_STREAMCOMMENT: { WCHAR cmnt_beg[8] = { L'\0' }; WCHAR cmnt_end[8] = { L'\0' }; - _GetStreamCommentStrgs(cmnt_beg, cmnt_end, COUNTOF(cmnt_beg)); + Lexer_GetStreamCommentStrgs(cmnt_beg, cmnt_end, COUNTOF(cmnt_beg)); if (StrIsNotEmpty(cmnt_beg)) { EditEncloseSelection(cmnt_beg, cmnt_end); } @@ -9238,8 +9090,7 @@ void UpdateMarginWidth(const bool bForce) SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, iLineMarginWidthFit); } } else { - // TODO: SCI Bug if set to 0 (=invisible), workaround use 1px - SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, +1); + SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, 0); } Style_SetBookmark(Globals.hwndEdit, Settings.ShowBookmarkMargin); Style_SetFolding(Globals.hwndEdit, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding)); diff --git a/src/Notepad3.vcxproj b/src/Notepad3.vcxproj index 51443754b..23eb559e7 100644 --- a/src/Notepad3.vcxproj +++ b/src/Notepad3.vcxproj @@ -604,6 +604,7 @@ + diff --git a/src/Notepad3.vcxproj.filters b/src/Notepad3.vcxproj.filters index 337cc2f88..fdd74a26d 100644 --- a/src/Notepad3.vcxproj.filters +++ b/src/Notepad3.vcxproj.filters @@ -411,6 +411,9 @@ Source Files\StyleLexers + + Source Files\StyleLexers + diff --git a/src/StyleLexers/EditLexer.c b/src/StyleLexers/EditLexer.c new file mode 100644 index 000000000..1701918a3 --- /dev/null +++ b/src/StyleLexers/EditLexer.c @@ -0,0 +1,253 @@ + +#include "lexers_x/SciXLexer.h" + +#include "SciCall.h" +#include "EditLexer.h" + + +void Lexer_GetStreamCommentStrgs(LPWSTR beg_out, LPWSTR end_out, size_t maxlen) +{ + if (beg_out && end_out && maxlen) { + + switch (SciCall_GetLexer()) { + case SCLEX_AU3: + StringCchCopy(beg_out, maxlen, L"#cs"); + StringCchCopy(end_out, maxlen, L"#ce"); + break; + case SCLEX_AVS: + case SCLEX_CPP: + case SCLEX_CSS: + case SCLEX_D: // L"/+", L"+/" could also be used instead + case SCLEX_DART: + case SCLEX_HTML: + case SCLEX_JSON: + case SCLEX_KOTLIN: + case SCLEX_NSIS: + case SCLEX_RUST: + case SCLEX_SQL: + case SCLEX_VHDL: + case SCLEX_XML: + StringCchCopy(beg_out, maxlen, L"/*"); + StringCchCopy(end_out, maxlen, L"*/"); + break; + case SCLEX_INNOSETUP: + case SCLEX_PASCAL: + StringCchCopy(beg_out, maxlen, L"{"); + StringCchCopy(end_out, maxlen, L"}"); + break; + case SCLEX_LUA: + StringCchCopy(beg_out, maxlen, L"--[["); + StringCchCopy(end_out, maxlen, L"]]"); + break; + case SCLEX_COFFEESCRIPT: + StringCchCopy(beg_out, maxlen, L"###"); + StringCchCopy(end_out, maxlen, L"###"); + break; + case SCLEX_MATLAB: + StringCchCopy(beg_out, maxlen, L"%{"); + StringCchCopy(end_out, maxlen, L"%}"); + break; + // ------------------ + case SCLEX_NULL: + case SCLEX_AHKL: + case SCLEX_ASM: + case SCLEX_BASH: + case SCLEX_BATCH: + case SCLEX_CMAKE: + case SCLEX_CONF: + case SCLEX_DIFF: + case SCLEX_LATEX: + case SCLEX_MAKEFILE: + case SCLEX_MARKDOWN: + case SCLEX_NIM: + case SCLEX_PERL: + case SCLEX_POWERSHELL: + case SCLEX_PROPERTIES: + case SCLEX_PYTHON: + case SCLEX_R: + case SCLEX_REGISTRY: + case SCLEX_RUBY: + case SCLEX_TCL: + case SCLEX_TOML: + case SCLEX_VB: + case SCLEX_VBSCRIPT: + case SCLEX_YAML: + default: + StringCchCopy(beg_out, maxlen, L""); + StringCchCopy(end_out, maxlen, L""); + break; + } + } +} + + +bool Lexer_GetLineCommentStrg(LPWSTR pre_out, size_t maxlen) +{ + if (pre_out && maxlen) { + + switch (SciCall_GetLexer()) { + case SCLEX_CPP: + case SCLEX_D: + case SCLEX_DART: + case SCLEX_HTML: + case SCLEX_JSON: + case SCLEX_KOTLIN: + case SCLEX_PASCAL: + case SCLEX_RUST: + case SCLEX_XML: + StringCchCopy(pre_out, maxlen, L"//"); + return false; + case SCLEX_VB: + case SCLEX_VBSCRIPT: + StringCchCopy(pre_out, maxlen, L"'"); + return false; + case SCLEX_AVS: + case SCLEX_BASH: + case SCLEX_CMAKE: + case SCLEX_COFFEESCRIPT: + case SCLEX_CONF: + case SCLEX_MAKEFILE: + case SCLEX_NIM: + case SCLEX_PERL: + case SCLEX_POWERSHELL: + case SCLEX_PYTHON: + case SCLEX_R: + case SCLEX_RUBY: + case SCLEX_TCL: + case SCLEX_TOML: + case SCLEX_YAML: + StringCchCopy(pre_out, maxlen, L"#"); + return true; + case SCLEX_AHKL: + case SCLEX_ASM: + case SCLEX_AU3: + case SCLEX_INNOSETUP: + case SCLEX_NSIS: // "#" could also be used instead + case SCLEX_PROPERTIES: + case SCLEX_REGISTRY: + StringCchCopy(pre_out, maxlen, L";"); + return true; + case SCLEX_LUA: + case SCLEX_SQL: + case SCLEX_VHDL: + StringCchCopy(pre_out, maxlen, L"--"); + return true; + case SCLEX_BATCH: // "::" could also be used instead + StringCchCopy(pre_out, maxlen, L"rem "); + return true; + case SCLEX_LATEX: + case SCLEX_MATLAB: + StringCchCopy(pre_out, maxlen, L"%"); + return true; + // ------------------ + case SCLEX_NULL: + case SCLEX_CSS: + case SCLEX_DIFF: + case SCLEX_MARKDOWN: + default: + StringCchCopy(pre_out, maxlen, L""); + break; + } + } + return false; +} + + +//============================================================================= +// +// Lexer_SetFoldingAvailability() +// +void Lexer_SetFoldingAvailability(PEDITLEXER pLexer) { + switch (pLexer->lexerID) { + case SCLEX_NULL: + case SCLEX_CONTAINER: + case SCLEX_BATCH: + case SCLEX_CONF: + case SCLEX_MAKEFILE: + case SCLEX_MARKDOWN: + FocusedView.CodeFoldingAvailable = false; + break; + default: + FocusedView.CodeFoldingAvailable = true; + break; + } +} + +//============================================================================= +// +// Lexer_SetFoldingProperties() +// +void Lexer_SetFoldingProperties(bool active) { + if (active) { + SciCall_SetProperty("fold", "1"); + SciCall_SetProperty("fold.comment", "1"); + SciCall_SetProperty("fold.compact", "0"); + SciCall_SetProperty("fold.foldsyntaxbased", "1"); + + SciCall_SetProperty("fold.html", "1"); + SciCall_SetProperty("fold.preprocessor", "1"); + SciCall_SetProperty("fold.cpp.comment.explicit", "0"); + } else { + SciCall_SetProperty("fold", "0"); + } +} + +//============================================================================= +// +// Lexer_SetFoldingFocusedView() +// +void Lexer_SetFoldingFocusedView() { + SciCall_SetProperty("fold", "0"); // disable folding by lexers + SciCall_SetProperty("fold.comment", "1"); + SciCall_SetProperty("fold.compact", "0"); +} + +//============================================================================= +// +// void Lexer_SetLexerSpecificProperties() +// +void Lexer_SetLexerSpecificProperties(const int lexerId) { + switch (lexerId) { + case SCLEX_CPP: + SciCall_SetProperty("styling.within.preprocessor", "1"); + SciCall_SetProperty("lexer.cpp.track.preprocessor", "0"); + SciCall_SetProperty("lexer.cpp.update.preprocessor", "0"); + break; + + case SCLEX_PASCAL: + SciCall_SetProperty("lexer.pascal.smart.highlighting", "1"); + break; + + case SCLEX_SQL: + SciCall_SetProperty("sql.backslash.escapes", "1"); + SciCall_SetProperty("lexer.sql.backticks.identifier", "1"); + SciCall_SetProperty("lexer.sql.numbersign.comment", Settings2.LexerSQLNumberSignAsComment ? "1" : "0"); + break; + + case SCLEX_NSIS: + SciCall_SetProperty("nsis.ignorecase", "1"); + break; + + case SCLEX_CSS: + SciCall_SetProperty("lexer.css.scss.language", "1"); + SciCall_SetProperty("lexer.css.less.language", "1"); + break; + + case SCLEX_JSON: + SciCall_SetProperty("json.allow.comments", "1"); + SciCall_SetProperty("json.escape.sequence", "1"); + break; + + case SCLEX_PYTHON: + SciCall_SetProperty("tab.timmy.whinge.level", "1"); + SciCall_SetProperty("lexer.python.strings.f", "1"); + break; + + case SCLEX_XML: + SciCall_SetProperty("lexer.xml.allow.scripts", "1"); + break; + + default: + break; + } +} diff --git a/src/StyleLexers/EditLexer.h b/src/StyleLexers/EditLexer.h index 857c32a5d..aeb95a53a 100644 --- a/src/StyleLexers/EditLexer.h +++ b/src/StyleLexers/EditLexer.h @@ -166,3 +166,12 @@ extern EDITLEXER lexYAML; // YAML "variant wend when while with withevents writeonly xor" // ----------------------------------------------------------------------------- + +void Lexer_GetStreamCommentStrgs(LPWSTR beg_out, LPWSTR end_out, size_t maxlen); +bool Lexer_GetLineCommentStrg(LPWSTR pre_out, size_t maxlen); +void Lexer_SetFoldingAvailability(PEDITLEXER pLexer); +void Lexer_SetFoldingProperties(bool active); +void Lexer_SetFoldingFocusedView(); +void Lexer_SetLexerSpecificProperties(const int lexerId); + +// ----------------------------------------------------------------------------- diff --git a/src/StyleLexers/StyleLexers.h b/src/StyleLexers/StyleLexers.h index b38a6c35c..61be36e7e 100644 --- a/src/StyleLexers/StyleLexers.h +++ b/src/StyleLexers/StyleLexers.h @@ -12,7 +12,6 @@ // ---------------------------------------------------------------------------- - #define MULTI_STYLE(a,b,c,d) ((a)|(b<<8)|(c<<16)|(d<<24)) #define EMPTY_KEYWORDLIST { NULL, } diff --git a/src/Styles.c b/src/Styles.c index 9b5e7d001..d2db61087 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -879,113 +879,6 @@ bool Style_ExportToFile(const WCHAR* szFile, bool bForceAll) } -//============================================================================= -// -// Style_SetFoldingAvailability() -// -void Style_SetFoldingAvailability(PEDITLEXER pLexer) -{ - switch (pLexer->lexerID) { - case SCLEX_NULL: - case SCLEX_CONTAINER: - case SCLEX_BATCH: - case SCLEX_CONF: - case SCLEX_MAKEFILE: - case SCLEX_MARKDOWN: - FocusedView.CodeFoldingAvailable = false; - break; - default: - FocusedView.CodeFoldingAvailable = true; - break; - } -} - - -//============================================================================= -// -// Style_SetFoldingProperties() -// -void Style_SetFoldingProperties(bool active) -{ - if (active) { - SciCall_SetProperty("fold", "1"); - SciCall_SetProperty("fold.comment", "1"); - SciCall_SetProperty("fold.compact", "0"); - SciCall_SetProperty("fold.foldsyntaxbased", "1"); - - SciCall_SetProperty("fold.html", "1"); - SciCall_SetProperty("fold.preprocessor", "1"); - SciCall_SetProperty("fold.cpp.comment.explicit", "0"); - } else { - SciCall_SetProperty("fold", "0"); - } -} - - -//============================================================================= -// -// Style_SetFoldingFocusedView() -// -void Style_SetFoldingFocusedView() -{ - SciCall_SetProperty("fold", "0"); // disable folding by lexers - SciCall_SetProperty("fold.comment", "1"); - SciCall_SetProperty("fold.compact", "0"); -} - - -//============================================================================= -// -// void Style_SetLexerSpecificProperties() -// -void Style_SetLexerSpecificProperties(const int lexerId) -{ - switch (lexerId) { - case SCLEX_CPP: - SciCall_SetProperty("styling.within.preprocessor", "1"); - SciCall_SetProperty("lexer.cpp.track.preprocessor", "0"); - SciCall_SetProperty("lexer.cpp.update.preprocessor", "0"); - break; - - case SCLEX_PASCAL: - SciCall_SetProperty("lexer.pascal.smart.highlighting", "1"); - break; - - case SCLEX_SQL: - SciCall_SetProperty("sql.backslash.escapes", "1"); - SciCall_SetProperty("lexer.sql.backticks.identifier", "1"); - SciCall_SetProperty("lexer.sql.numbersign.comment", Settings2.LexerSQLNumberSignAsComment ? "1" : "0"); - break; - - case SCLEX_NSIS: - SciCall_SetProperty("nsis.ignorecase", "1"); - break; - - case SCLEX_CSS: - SciCall_SetProperty("lexer.css.scss.language", "1"); - SciCall_SetProperty("lexer.css.less.language", "1"); - break; - - case SCLEX_JSON: - SciCall_SetProperty("json.allow.comments", "1"); - SciCall_SetProperty("json.escape.sequence", "1"); - break; - - case SCLEX_PYTHON: - SciCall_SetProperty("tab.timmy.whinge.level", "1"); - SciCall_SetProperty("lexer.python.strings.f", "1"); - break; - - case SCLEX_XML: - SciCall_SetProperty("lexer.xml.allow.scripts", "1"); - break; - - default: - break; - } -} - - //============================================================================= // // Style_StrGetAttributeEx() @@ -1104,11 +997,11 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) #endif // Lexer very specific styles - Style_SetLexerSpecificProperties(pLexNew->lexerID); + Lexer_SetLexerSpecificProperties(pLexNew->lexerID); // Code folding - Style_SetFoldingAvailability(pLexNew); - Style_SetFoldingProperties(FocusedView.CodeFoldingAvailable); + Lexer_SetFoldingAvailability(pLexNew); + Lexer_SetFoldingProperties(FocusedView.CodeFoldingAvailable); // Add KeyWord Lists for (int i = 0; i <= KEYWORDSET_MAX; ++i) { diff --git a/src/Styles.h b/src/Styles.h index a0e113c13..930433e51 100644 --- a/src/Styles.h +++ b/src/Styles.h @@ -47,9 +47,6 @@ bool Style_InsertThemesMenu(HMENU hMenuBar); void Style_DynamicThemesMenuCmd(int cmd, unsigned iCurThemeIdx); float Style_GetCurrentFontSize(); -void Style_SetFoldingAvailability(PEDITLEXER pLexer); -void Style_SetFoldingProperties(bool active); -void Style_SetFoldingFocusedView(); void Style_SetLexer(HWND hwnd,PEDITLEXER pLexNew); void Style_FillRelatedStyles(HWND hwnd, const PEDITLEXER pLexer); void Style_SetUrlHotSpot(HWND hwnd);