diff --git a/Versions/build.txt b/Versions/build.txt
index febba2821..cd59a34b2 100644
--- a/Versions/build.txt
+++ b/Versions/build.txt
@@ -1 +1 @@
-2383
+2384
diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf
index 044dc2fbd..83be3f1d0 100644
--- a/res/Notepad3.exe.manifest.conf
+++ b/res/Notepad3.exe.manifest.conf
@@ -3,7 +3,7 @@
Notepad3 Oniguruma
diff --git a/src/Dialogs.c b/src/Dialogs.c
index 035f858a1..b4b87bc2d 100644
--- a/src/Dialogs.c
+++ b/src/Dialogs.c
@@ -3550,6 +3550,11 @@ void SetAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo)
StringCchCopy(szAdditionalTitleInfo, COUNTOF(szAdditionalTitleInfo), lpszAddTitleInfo);
}
+void AppendAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo)
+{
+ StringCchCat(szAdditionalTitleInfo, COUNTOF(szAdditionalTitleInfo), lpszAddTitleInfo);
+}
+
//=============================================================================
//
diff --git a/src/Dialogs.h b/src/Dialogs.h
index a6b77040a..46e1ff09b 100644
--- a/src/Dialogs.h
+++ b/src/Dialogs.h
@@ -54,6 +54,7 @@ DWORD GetLastErrorToMsgBox(LPWSTR lpszFunction, DWORD dwErrID);
bool SetWindowTitle(HWND hwnd, UINT uIDAppName, bool, UINT uIDUntitled, LPCWSTR lpszFile, int iFormat, bool, UINT uIDReadOnly, bool, LPCWSTR lpszExcerpt);
void SetAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo);
+void AppendAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo);
void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode, int iOpacityLevel);
void CenterDlgInParent(HWND hDlg);
void GetDlgPos(HWND hDlg, LPINT xDlg, LPINT yDlg);
diff --git a/src/Edit.c b/src/Edit.c
index 652e533c7..f62fb70cd 100644
--- a/src/Edit.c
+++ b/src/Edit.c
@@ -1024,7 +1024,6 @@ bool EditLoadFile(
cpi_enc_t iForcedEncoding = Globals.bForceReLoadAsUTF8 ? CPI_UTF8 :
((Settings.LoadNFOasOEM && bNfoDizDetected) ? Globals.DOSEncoding : Encoding_SrcCmdLn(CPI_GET));
-
// --- 2nd Use Encoding Analysis if applicable
size_t const cbNbytes4Analysis = (cbData < 200000L) ? cbData : 200000L;
@@ -1049,6 +1048,13 @@ bool EditLoadFile(
#endif
}
}
+ else {
+ if (Flags.bDevDebugMode) {
+ WCHAR wchBuf[128] = { L'\0' };
+ StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"ForcedEncoding='%s'", g_Encodings[iForcedEncoding].wchLabel);
+ SetAdditionalTitleInfo(wchBuf);
+ }
+ }
// ------------------------------------------------------
@@ -1180,6 +1186,15 @@ bool EditLoadFile(
FileVars_Init(lpData, cbData, &Globals.fvCurFile);
+ if (Flags.bDevDebugMode) {
+ if (FileVars_IsValidEncoding(&Globals.fvCurFile)) {
+ WCHAR wchBuf[128] = { L'\0' };
+ StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"FileVarEncoding='%s'",
+ g_Encodings[FileVars_GetEncoding(&Globals.fvCurFile)].wchLabel);
+ SetAdditionalTitleInfo(wchBuf);
+ }
+ }
+
// === UTF-8 ===
bool const bValidUTF8 = IsValidUTF8(lpData, cbData);
bool const bForcedUTF8 = Encoding_IsUTF8(iForcedEncoding) || (FileVars_IsUTF8(&Globals.fvCurFile) && !Settings.NoEncodingTags);
@@ -1207,6 +1222,7 @@ bool EditLoadFile(
if (bIsForced)
status->iEncoding = iForcedEncoding;
+
else {
status->iEncoding = FileVars_GetEncoding(&Globals.fvCurFile);
if (Encoding_IsNONE(status->iEncoding))
@@ -1264,6 +1280,12 @@ bool EditLoadFile(
SciCall_SetCharacterCategoryOptimization(Encoding_IsCJK(iAnalyzedEncoding) ? 0x10000 : 0x1000);
+ if (Flags.bDevDebugMode) {
+ WCHAR wcBuf[128] = { L'\0' };
+ StringCchPrintf(wcBuf, ARRAYSIZE(wcBuf), L" OS-CP='%s'", g_Encodings[CPI_ANSI_DEFAULT].wchLabel);
+ AppendAdditionalTitleInfo(wcBuf);
+ }
+
return true;
}
diff --git a/src/EncodingDetection.cpp b/src/EncodingDetection.cpp
index a3dbe433d..170221a6b 100644
--- a/src/EncodingDetection.cpp
+++ b/src/EncodingDetection.cpp
@@ -873,7 +873,7 @@ static void _SetEncodingTitleInfo(const char* encodingUCD, cpi_enc_t encUCD, flo
//~ StringCchCatA(chEncodingInfo, ARRAYSIZE(chEncodingInfo), "'");
//~}
- StringCchPrintfA(tmpBuf, 128, (int)lroundf(ucd_conf_perc) >= Settings2.AnalyzeReliableConfidenceLevel ? " (reliable)" : " (NOT reliable)");
+ StringCchPrintfA(tmpBuf, ARRAYSIZE(tmpBuf), (int)lroundf(ucd_conf_perc) >= Settings2.AnalyzeReliableConfidenceLevel ? " (reliable)" : " (NOT reliable)");
StringCchCatA(chEncodingInfo, ARRAYSIZE(chEncodingInfo), tmpBuf);
MultiByteToWideChar(CP_UTF7, 0, chEncodingInfo, -1, wchEncodingInfo, ARRAYSIZE(wchEncodingInfo));
diff --git a/src/Helpers.c b/src/Helpers.c
index c6002d7b6..cd97e2c57 100644
--- a/src/Helpers.c
+++ b/src/Helpers.c
@@ -1504,8 +1504,9 @@ bool MRU_Empty(LPMRULIST pmru)
pmru->pszItems[i] = NULL;
pmru->iEncoding[i] = 0;
pmru->iCaretPos[i] = 0;
- if (pmru->pszBookMarks[i])
+ if (pmru->pszBookMarks[i]) {
LocalFree(pmru->pszBookMarks[i]); // StrDup()
+ }
pmru->pszBookMarks[i] = NULL;
}
}
@@ -1573,7 +1574,7 @@ bool MRU_Save(LPMRULIST pmru)
if (LoadIniFile(Globals.IniFile)) {
const WCHAR* const RegKey_Section = pmru->szRegKey;
- //IniDeleteSection(pmru->szRegKey);
+ IniSectionClear(pmru->szRegKey, false);
for (int i = 0; i < pmru->iSize; i++) {
if (pmru->pszItems[i]) {
diff --git a/src/Notepad3.c b/src/Notepad3.c
index b35735f23..aec1bb5e8 100644
--- a/src/Notepad3.c
+++ b/src/Notepad3.c
@@ -1209,6 +1209,7 @@ HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow)
if (s_lpEncodingArg) {
Encoding_SrcCmdLn(Encoding_MatchW(s_lpEncodingArg));
}
+
// Pathname parameter
if (s_flagIsElevatedRelaunch || (StrIsNotEmpty(s_lpFileArg) /*&& !g_flagNewFromClipboard*/))
{
@@ -7557,6 +7558,7 @@ void ParseCommandLine()
// Encoding
cpi_enc_t const encoding = Encoding_MatchW(lp1);
+
if (StringCchCompareXI(lp1, L"ANSI") == 0 || StringCchCompareXI(lp1, L"A") == 0 || StringCchCompareXI(lp1, L"MBCS") == 0) {
s_flagSetEncoding = CPI_ANSI_DEFAULT;
}
@@ -7576,8 +7578,12 @@ void ParseCommandLine()
}
// maybe parsed encoding
else if (encoding != CPI_NONE) {
+ if (s_lpEncodingArg) { LocalFree(s_lpEncodingArg); }
+ s_lpEncodingArg = StrDup(lp1);
s_flagSetEncoding = encoding;
}
+
+
// EOL Mode
else if (StringCchCompareXI(lp1, L"CRLF") == 0 || StringCchCompareXI(lp1, L"CR+LF") == 0) {
s_flagSetEOLMode = IDM_LINEENDINGS_CRLF - IDM_LINEENDINGS_CRLF + 1;
diff --git a/src/VersionEx.h b/src/VersionEx.h
index 737966af5..31be072bd 100644
--- a/src/VersionEx.h
+++ b/src/VersionEx.h
@@ -8,7 +8,7 @@
#define VERSION_MAJOR 5
#define VERSION_MINOR 19
#define VERSION_REV 704
-#define VERSION_BUILD 2383
+#define VERSION_BUILD 2384
#define SCINTILLA_VER 417
#define ONIGURUMA_REGEX_VER 6.9.2
#define VERSION_PATCH Oniguruma