diff --git a/src/Notepad4.cpp b/src/Notepad4.cpp index c16677300f..cc0ad78b1d 100644 --- a/src/Notepad4.cpp +++ b/src/Notepad4.cpp @@ -140,7 +140,7 @@ int iChangeHistoryMarker; EditAutoCompletionConfig autoCompletionConfig; int iSelectOption; static int iLineSelectionMode; -static bool bShowCodeFolding; +bool bShowCodeFolding; extern CallTipInfo callTipInfo; static bool bViewWhiteSpace; static bool bViewEOLs; @@ -1650,11 +1650,6 @@ void UpdateBookmarkMarginWidth() noexcept { SciCall_SetMarginWidth(MarginNumber_Bookmark, width); } -void UpdateFoldMarginWidth() noexcept { - const int width = bShowCodeFolding ? SciCall_TextWidth(STYLE_LINENUMBER, "+_") : 0; - SciCall_SetMarginWidth(MarginNumber_CodeFolding, width); -} - void SetWrapVisualFlags() noexcept { if (bShowWordWrapSymbols) { int wrapVisualFlags = 0; diff --git a/src/Styles.cpp b/src/Styles.cpp index 6422d2a4c1..4f26edde0b 100644 --- a/src/Styles.cpp +++ b/src/Styles.cpp @@ -362,8 +362,10 @@ extern int iDefaultCodePage; extern int iDefaultCharSet; extern LineHighlightMode iHighlightCurrentLine; extern bool bShowBookmarkMargin; +extern bool bShowCodeFolding; extern int iZoomLevel; extern bool bUseXPFileDialog; +extern bool flagSimpleIndentGuides; // LF_FACESIZE is 32, LOCALE_NAME_MAX_LENGTH is 85 #define MAX_STYLE_VALUE_LENGTH LOCALE_NAME_MAX_LENGTH @@ -392,7 +394,7 @@ enum GlobalStyleIndex { GlobalStyleIndex_IMEIndicator, // indicator style. `fore`: IME indicator color GlobalStyleIndex_LongLineMarker, // standalone style. `fore`: edge line color, `back`: background color for text exceeds long line limit GlobalStyleIndex_ExtraLineSpacing, // standalone style. descent = `size`/2, ascent = `size` - descent - GlobalStyleIndex_CodeFolding, // standalone style. `fore`, `back` + GlobalStyleIndex_CodeFolding, // standalone style. `fore`, `back`, `size` GlobalStyleIndex_FoldingMarker, // standalone style. `fore`: folding line color, `back`: plus/minus box fill color GlobalStyleIndex_FoldDispalyText, // inherited style. GlobalStyleIndex_MarkOccurrences, // indicator style. `fore`, `alpha`, `outline` @@ -3085,8 +3087,6 @@ void Style_HighlightCurrentLine() noexcept { // // Style_SetIndentGuides() // -extern bool flagSimpleIndentGuides; - void Style_SetIndentGuides(bool bShow) noexcept { int iIndentView = SC_IV_NONE; if (bShow) { @@ -3149,6 +3149,22 @@ void Style_SetBookmark() noexcept { bBookmarkColorUpdated = false; } +void UpdateFoldMarginWidth() noexcept { + int width = 0; + if (bShowCodeFolding) { + LPCWSTR szValue = lexGlobal.Styles[GlobalStyleIndex_CodeFolding].szValue; + Style_StrGetSize(szValue, &width); + if (width != 0) { + const int scale = g_uCurrentDPI*iZoomLevel; + if (scale != USER_DEFAULT_SCREEN_DPI*100) { + width = MulDiv(width, scale, USER_DEFAULT_SCREEN_DPI*100); + } + } + width += SciCall_TextWidth(STYLE_LINENUMBER, "+_"); + } + SciCall_SetMarginWidth(MarginNumber_CodeFolding, width); +} + //============================================================================= // // Style_GetOpenDlgFilterStr() diff --git a/wiki b/wiki index aa78a97070..26ee35b245 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit aa78a9707065488b4059c760b67bdacea8dac9cb +Subproject commit 26ee35b245821e1fbf52fc6a5c8d09e37e1e02a2