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();
diff --git a/Versions/build.txt b/Versions/build.txt
index 00750edc0..d00491fd7 100644
--- a/Versions/build.txt
+++ b/Versions/build.txt
@@ -1 +1 @@
-3
+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 6685f4693..f9df86410 100644
--- a/res/Notepad3.exe.manifest.conf
+++ b/res/Notepad3.exe.manifest.conf
@@ -3,7 +3,7 @@
Notepad3 RC3
diff --git a/src/Dialogs.c b/src/Dialogs.c
index 1b02f2cf6..07a88abd3 100644
--- a/src/Dialogs.c
+++ b/src/Dialogs.c
@@ -1688,10 +1688,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);
}
@@ -1914,6 +1911,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/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/Notepad3.c b/src/Notepad3.c
index 63420c92b..307a984cb 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -3364,6 +3364,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);
@@ -3387,13 +3388,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);
diff --git a/src/VersionEx.h b/src/VersionEx.h
index 7f27f89eb..8766ecbbd 100644
--- a/src/VersionEx.h
+++ b/src/VersionEx.h
@@ -8,8 +8,8 @@
#define SAPPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 20
-#define VERSION_REV 309
-#define VERSION_BUILD 3
+#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