From 9beeaef01621fa28f39a8295597af01c4fbf2352 Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Mon, 9 Mar 2020 21:51:14 +0100 Subject: [PATCH 1/4] Minor correction to sync design file --- Build/notepad3_setup.iss | 1 - Build/notepad3_x86_setup.iss | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Build/notepad3_setup.iss b/Build/notepad3_setup.iss index dc0847e9c..5b27d505b 100644 --- a/Build/notepad3_setup.iss +++ b/Build/notepad3_setup.iss @@ -386,7 +386,6 @@ begin RegWriteStringValue(HKCR, '*\shell\Open with Notepad3', 'Icon', ExpandConstant('{app}\Notepad3.exe,0')); RegWriteStringValue(HKCR, '*\shell\Open with Notepad3\command', '', ExpandConstant('"{app}\Notepad3.exe" "%1"')); - end; diff --git a/Build/notepad3_x86_setup.iss b/Build/notepad3_x86_setup.iss index a81cda1d3..cfa0cb7a8 100644 --- a/Build/notepad3_x86_setup.iss +++ b/Build/notepad3_x86_setup.iss @@ -1,6 +1,6 @@ ;* Notepad3 - Installer script ;* -;* (c) Rizonesoft 2008-2020 +;* (c) Rizonesoft 2008-2020 ; Requirements: ; Inno Setup: http://www.jrsoftware.org/isdl.php @@ -171,6 +171,7 @@ Source: Docs\uthash\utlist.txt; DestDir: {ap Source: Docs\uthash\utringbuffer.txt; DestDir: {app}\Docs\uthash; Flags: ignoreversion Source: Docs\uthash\utstring.txt; DestDir: {app}\Docs\uthash; Flags: ignoreversion + [Dirs] Name: "{userappdata}\Rizonesoft\Notepad3\Favorites" Name: "{userappdata}\Rizonesoft\Notepad3\themes" @@ -341,8 +342,7 @@ begin RegWriteStringValue(HKCR, '*\shell\Open with Notepad3', 'Icon', ExpandConstant('{app}\Notepad3.exe,0')); RegWriteStringValue(HKCR, '*\shell\Open with Notepad3\command', '', ExpandConstant('"{app}\Notepad3.exe" "%1"')); - - end; +end; procedure CleanUpSettings(); From 425a10803809aeb0df568949ee1c4a8d382baac4 Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Mon, 9 Mar 2020 21:51:51 +0100 Subject: [PATCH 2/4] + upd: Versioning files --- Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/VersionEx.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index 00750edc0..b8626c4cf 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -3 +4 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 6685f4693..de063d2cf 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 RC3 diff --git a/src/VersionEx.h b/src/VersionEx.h index 7f27f89eb..0a5d0900b 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -9,11 +9,11 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 20 #define VERSION_REV 309 -#define VERSION_BUILD 3 +#define VERSION_BUILD 4 #define SCINTILLA_VER 432 #define ONIGURUMA_REGEX_VER 6.9.4 #define UCHARDET_VER 2018.09.27 #define TINYEXPR_VER 2018.05.11 #define UTHASH_VER 2.1.0 #define VERSION_PATCH RC3 -#define VERSION_COMMIT_ID nebukadn +#define VERSION_COMMIT_ID dkt1-amr From 063eff4975cfec50ef863d11893509ddd2cd03f9 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Tue, 10 Mar 2020 11:45:41 +0100 Subject: [PATCH 3/4] + fix: remember caret position only possible with file history --- src/Dialogs.c | 12 ++++++++---- src/Notepad3.c | 8 +------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Dialogs.c b/src/Dialogs.c index cfa36678e..48f69bd15 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -1687,10 +1687,7 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM CheckDlgButton(hwnd, IDC_PRESERVECARET, SetBtn(Settings.PreserveCaretPos)); CheckDlgButton(hwnd, IDC_REMEMBERSEARCHPATTERN, SetBtn(Settings.SaveFindReplace)); - //~if (!Settings.SaveRecentFiles) { - //~ DialogEnableWindow(hwnd,IDC_PRESERVECARET, false); - //~ DialogEnableWindow(hwnd,IDC_REMEMBERSEARCHPATTERN, false); - //~} + DialogEnableControl(hwnd,IDC_PRESERVECARET, Settings.SaveRecentFiles); CenterDlgInParent(hwnd, NULL); } @@ -1913,6 +1910,13 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM case IDC_FILEMRU: break; + case IDC_SAVEMRU: + { + bool const bSaveMRU = IsButtonChecked(hwnd, IDC_SAVEMRU); + DialogEnableControl(hwnd, IDC_PRESERVECARET, bSaveMRU); + } + break; + case IDOK: case IDC_REMOVE: { diff --git a/src/Notepad3.c b/src/Notepad3.c index 2bf3d8ec6..c12e4320b 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -3409,6 +3409,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam) CheckCmd(hmenu, IDM_VIEW_NOSAVERECENT, Settings.SaveRecentFiles); CheckCmd(hmenu, IDM_VIEW_NOPRESERVECARET, Settings.PreserveCaretPos); + EnableCmd(hmenu, IDM_VIEW_NOPRESERVECARET, Settings.SaveRecentFiles); CheckCmd(hmenu, IDM_VIEW_NOSAVEFINDREPL, Settings.SaveFindReplace); CheckCmd(hmenu, IDM_VIEW_SAVEBEFORERUNNINGTOOLS, Settings.SaveBeforeRunningTools); @@ -3432,13 +3433,6 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam) i = IDM_VIEW_NOESCFUNC; CheckMenuRadioItem(hmenu, IDM_VIEW_NOESCFUNC, IDM_VIEW_ESCEXIT, i, MF_BYCOMMAND); - EnableCmd(hmenu, IDM_VIEW_REUSEWINDOW, i); - EnableCmd(hmenu, IDM_VIEW_STICKYWINPOS, i); - EnableCmd(hmenu, IDM_VIEW_SINGLEFILEINSTANCE, i); - EnableCmd(hmenu, IDM_VIEW_NOSAVERECENT, i); - EnableCmd(hmenu, IDM_VIEW_NOPRESERVECARET, i); - EnableCmd(hmenu, IDM_VIEW_NOSAVEFINDREPL, i); - EnableCmd(hmenu, CMD_WEBACTION1, !se && !mrs && bPosInSel); EnableCmd(hmenu, CMD_WEBACTION2, !se && !mrs && bPosInSel); bool const bIsHLink = (SciCall_IndicatorValueAt(INDIC_NP3_HYPERLINK, iCurPos) > 0); From e3fdccdda26f984b9716f561766d387d4b24834d Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Tue, 10 Mar 2020 12:39:31 +0100 Subject: [PATCH 4/4] + increase confidence for ANSI encoding detection if current ANSI locale is detected --- Versions/build.txt | 2 +- Versions/day.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Encoding.h | 3 +++ src/EncodingDetection.cpp | 16 ++++++++++------ src/VersionEx.h | 6 +++--- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Versions/build.txt b/Versions/build.txt index b8626c4cf..d00491fd7 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -4 +1 diff --git a/Versions/day.txt b/Versions/day.txt index 7536e3d32..54ea97e96 100644 --- a/Versions/day.txt +++ b/Versions/day.txt @@ -1 +1 @@ -309 +310 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index de063d2cf..f9df86410 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 RC3 diff --git a/src/Encoding.h b/src/Encoding.h index ae12a6b89..774d82c3a 100644 --- a/src/Encoding.h +++ b/src/Encoding.h @@ -184,6 +184,9 @@ typedef struct _enc_det_t } ENC_DET_T; +// 0.0 - 1.0: confidence bonus for local ANSI detection +// 0 = no bonus, 1 = 100% confidence that, if local ANSI is detected, that it is local ANSI code-page +#define LOCAL_ANSI_BONUS_FAC (0.66f) // ~2/3 ENC_DET_T Encoding_DetectEncoding(LPWSTR pszFile, const char* lpData, const size_t cbData, const cpi_enc_t iAnalyzeFallback, diff --git a/src/EncodingDetection.cpp b/src/EncodingDetection.cpp index 2d0c851e8..af08b978d 100644 --- a/src/EncodingDetection.cpp +++ b/src/EncodingDetection.cpp @@ -507,6 +507,10 @@ extern "C" void ChangeEncodingCodePage(const cpi_enc_t cpi, UINT newCP) //============================================================================= +constexpr float clampf(float x, float lower, float upper) { return (x < lower) ? lower : ((x > upper) ? upper : x); } + +//============================================================================= + cpi_enc_t GetUnicodeEncoding(const char* pBuffer, const size_t len, bool* lpbBOM, bool* lpbReverse) { cpi_enc_t iEncoding = CPI_NONE; @@ -782,7 +786,8 @@ cpi_enc_t Encoding_AnalyzeText //~cpiEncoding_CED = AnalyzeText_CED(text, len, encodingHint, &ced_cnf, encodingStrg_CED, MAX_ENC_STRG_LEN); //~if (ced_cnf < 1.0f) //~{ - cpiEncoding_UCD = AnalyzeText_UCHARDET(text, len, encodingHint, &ucd_cnf, encodingStrg_UCD, MAX_ENC_STRG_LEN); + cpiEncoding_UCD = AnalyzeText_UCHARDET(text, len, encodingHint, &ucd_cnf, encodingStrg_UCD, MAX_ENC_STRG_LEN); + ucd_cnf = clampf(ucd_cnf, 0.0f, 1.0f); //~} //~else { //~ cpiEncoding_UCD = CPI_NONE; @@ -791,11 +796,10 @@ cpi_enc_t Encoding_AnalyzeText #endif - float confidence = 0.0f; - float const ucd_confidence = ucd_cnf; - //~float const ced_confidence = ced_cnf; UINT const codePage_UCD = Encoding_GetCodePage(cpiEncoding_UCD); - //~UINT const codePage_CED = Encoding_GetCodePage(cpiEncoding_CED); + // extra bonus, if detected encoding is local codepage + float const bonus = (codePage_UCD == Encoding_GetCodePage(CPI_ANSI_DEFAULT)) ? (1.0f - ucd_cnf) * LOCAL_ANSI_BONUS_FAC : 0.0f; + float const ucd_confidence = clampf(ucd_cnf + bonus, 0.0f, 1.0f); if (Flags.bDevDebugMode) @@ -847,7 +851,7 @@ cpi_enc_t Encoding_AnalyzeText // -------------------------------------------------------------------------- cpi_enc_t iAnalyzedEncoding = cpiEncoding_UCD; - confidence = ucd_confidence; + float confidence = ucd_confidence; /* ~~~ if ((cpiEncoding_UCD == cpiEncoding_CED) && !Encoding_IsNONE(cpiEncoding_UCD)) diff --git a/src/VersionEx.h b/src/VersionEx.h index 0a5d0900b..8766ecbbd 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,12 +8,12 @@ #define SAPPNAME "Notepad3" #define VERSION_MAJOR 5 #define VERSION_MINOR 20 -#define VERSION_REV 309 -#define VERSION_BUILD 4 +#define VERSION_REV 310 +#define VERSION_BUILD 1 #define SCINTILLA_VER 432 #define ONIGURUMA_REGEX_VER 6.9.4 #define UCHARDET_VER 2018.09.27 #define TINYEXPR_VER 2018.05.11 #define UTHASH_VER 2.1.0 #define VERSION_PATCH RC3 -#define VERSION_COMMIT_ID dkt1-amr +#define VERSION_COMMIT_ID nebukadn