From 720f2265fb7e418a6f2490101e4770bb954ef4d3 Mon Sep 17 00:00:00 2001 From: RaiKoHoff Date: Tue, 28 Apr 2020 13:13:34 +0200 Subject: [PATCH] + fix: lost Find/Replace dialog settings + fix: lazy syntax styling (copy into multi-line string, etc.) --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Edit.c | 3 ++- src/Notepad3.c | 32 +++++++++++++++++--------------- src/Styles.c | 5 ++--- src/VersionEx.h | 4 ++-- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index d00491fd7..0cfbf0888 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -1 +2 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index e441ec63e..ff5be37b3 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 BETA diff --git a/src/Edit.c b/src/Edit.c index b1580cdd1..8b47b0bf5 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -5843,6 +5843,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara case WM_DESTROY: { _SetSearchFlags(hwnd, sg_pefrData); // sync + Settings.EFR_Data = *sg_pefrData; // remember options if (!s_bSwitchedFindReplace) { @@ -5904,7 +5905,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara DeleteObject(hBrushBlue); ResizeDlg_Destroy(hwnd, &Settings.FindReplaceDlgSizeX, NULL); } - return false; + return 0; case WM_SIZE: { diff --git a/src/Notepad3.c b/src/Notepad3.c index fcf9add31..76f68ea61 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -1793,18 +1793,21 @@ static void _SetWrapVisualFlags(HWND hwndEditCtrl) // static void _InitializeSciEditCtrl(HWND hwndEditCtrl) { - if (IsWindowsVistaOrGreater()) { - // Current platforms perform window buffering so it is almost always better for this option to be turned off. - // There are some older platforms and unusual modes where buffering may still be useful - so keep it ON - //~SciCall_SetBufferedDraw(true); // default is true - if (Settings.RenderingTechnology > 0) { - SciCall_SetTechnology(s_DirectWriteTechnology[Settings.RenderingTechnology]); - SciCall_SetBufferedDraw(false); - // experimental - SciCall_SetBidirectional(s_SciBidirectional[Settings.Bidirectional]); - } + // Current platforms perform window buffering so it is almost always better for this option to be turned off. + // There are some older platforms and unusual modes where buffering may still be useful - so keep it ON + //~SCI_SETBUFFEREDDRAW(true); // default is true + if (Settings.RenderingTechnology > 0) + { + SendMessage(hwndEditCtrl, SCI_SETTECHNOLOGY, (WPARAM)s_DirectWriteTechnology[Settings.RenderingTechnology], 0); + SendMessage(hwndEditCtrl, SCI_SETBUFFEREDDRAW, 0, 0); // false + SendMessage(hwndEditCtrl, SCI_SETBIDIRECTIONAL, (WPARAM)s_SciBidirectional[Settings.Bidirectional], 0); // experimental } - Encoding_Current(Settings.DefaultEncoding); + //~SendMessage(hwndEditCtrl, SCI_SETPHASESDRAW, SC_PHASES_TWO, 0); // (= default) + SendMessage(hwndEditCtrl, SCI_SETPHASESDRAW, SC_PHASES_MULTIPLE, 0); + //~SendMessage(hwndEditCtrl, SCI_SETLAYOUTCACHE, SC_CACHE_PAGE, 0); + SendMessage(hwndEditCtrl, SCI_SETLAYOUTCACHE, SC_CACHE_DOCUMENT, 0); + //~SendMessage(hwndEditCtrl, SCI_SETPOSITIONCACHE, 1024, 0); // default = 1024 + SendMessage(hwndEditCtrl, SCI_SETPOSITIONCACHE, 4096, 0); //int const evtMask = SC_MODEVENTMASKALL; // The possible notification types are the same as the modificationType bit flags used by SCN_MODIFIED: @@ -1821,9 +1824,6 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl) SendMessage(hwndEditCtrl, SCI_SETMODEVENTMASK, (WPARAM)(evtMask1 | evtMask2), 0); SendMessage(hwndEditCtrl, SCI_SETCOMMANDEVENTS, false, 0); // speedup folding SendMessage(hwndEditCtrl, SCI_SETCODEPAGE, (WPARAM)SC_CP_UTF8, 0); // fixed internal UTF-8 (Sci:default) - SendMessage(hwndEditCtrl, SCI_SETLAYOUTCACHE, SC_CACHE_PAGE, 0); - //SendMessage(hwndEditCtrl, SCI_SETLAYOUTCACHE, SC_CACHE_DOCUMENT, 0); - //SendMessage(hwndEditCtrl, SCI_SETPHASESDRAW, SC_PHASES_MULTIPLE, 0); // default: SC_PHASES_TWO SendMessage(hwndEditCtrl, SCI_SETEOLMODE, Settings.DefaultEOLMode, 0); SendMessage(hwndEditCtrl, SCI_SETPASTECONVERTENDINGS, true, 0); @@ -1843,10 +1843,10 @@ static void _InitializeSciEditCtrl(HWND hwndEditCtrl) SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSBLINK, true, 0); SendMessage(hwndEditCtrl, SCI_SETADDITIONALCARETSVISIBLE, true, 0); - SendMessage(hwndEditCtrl, SCI_SETIDLESTYLING, SC_IDLESTYLING_NONE, 0); // needed for focused view // Idle Styling (very large text) //~~~SendMessage(hwndEditCtrl, SCI_SETIDLESTYLING, SC_IDLESTYLING_AFTERVISIBLE, 0); //~~~SendMessage(hwndEditCtrl, SCI_SETIDLESTYLING, SC_IDLESTYLING_ALL, 0); + SendMessage(hwndEditCtrl, SCI_SETIDLESTYLING, SC_IDLESTYLING_NONE, 0); // needed for focused view // assign command keys SendMessage(hwndEditCtrl, SCI_ASSIGNCMDKEY, (SCK_NEXT + (SCMOD_CTRL << 16)), SCI_PARADOWN); @@ -2092,6 +2092,8 @@ LRESULT MsgCreate(HWND hwnd, WPARAM wParam,LPARAM lParam) } Style_SetDefaultLexer(Globals.hwndEdit); + Encoding_Current(Settings.DefaultEncoding); + ObserveNotifyChangeEvent(); return 0LL; diff --git a/src/Styles.c b/src/Styles.c index 9bc0691a5..cb91e8457 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -805,7 +805,6 @@ void Style_ToIniSection(bool bForceAll) // cleanup old (< v4) stuff IniSectionDelete(L"Default Text", NULL, true); IniSectionDelete(L"2nd Default Text", NULL, true); - } @@ -1495,10 +1494,10 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) Style_SetInvisible(hwnd, false); // set fixed invisible style - SciCall_StartStyling(0); - _OBSERVE_NOTIFY_CHANGE_; + SciCall_StartStyling(0); + // apply lexer styles if (Flags.bLargeFileLoaded) { diff --git a/src/VersionEx.h b/src/VersionEx.h index 32a99d355..c04c923b0 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -9,11 +9,11 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 20 #define VERSION_REV 428 -#define VERSION_BUILD 1 +#define VERSION_BUILD 2 #define SCINTILLA_VER 432 #define ONIGURUMA_REGEX_VER 6.9.5 #define UCHARDET_VER 2018.09.27 #define TINYEXPR_VER 2018.05.11 #define UTHASH_VER 2.1.0 #define VERSION_PATCH BETA -#define VERSION_COMMIT_ID dkt1-amr +#define VERSION_COMMIT_ID t7820-rk