mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
Merge pull request #1387 from RaiKoHoff/Dev_ONIGURUMA
Extended encoding detection debug information
This commit is contained in:
commit
e849111d9d
@ -1 +1 @@
|
||||
2383
|
||||
2384
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.19.704.2383"
|
||||
version="5.19.704.2384"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 Oniguruma</description>
|
||||
|
||||
@ -3550,6 +3550,11 @@ void SetAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo)
|
||||
StringCchCopy(szAdditionalTitleInfo, COUNTOF(szAdditionalTitleInfo), lpszAddTitleInfo);
|
||||
}
|
||||
|
||||
void AppendAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo)
|
||||
{
|
||||
StringCchCat(szAdditionalTitleInfo, COUNTOF(szAdditionalTitleInfo), lpszAddTitleInfo);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
|
||||
@ -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);
|
||||
|
||||
24
src/Edit.c
24
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;
|
||||
}
|
||||
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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]) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user