From bc2c337fcef5013407cb415c888b37c77ddd905a Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Fri, 6 Oct 2017 16:38:25 +0200 Subject: [PATCH 1/4] +fix bug: in-text encoding (convert encoding) --- src/Edit.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Edit.c b/src/Edit.c index 48611a0a5..5ff61c06a 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -449,7 +449,8 @@ BOOL EditConvertText(HWND hwnd,int encSource,int encDest,BOOL bSetSavePoint) length = (int)SendMessage(hwnd,SCI_GETLENGTH,0,0); - if (length == 0) { + if (length == 0) + { SendMessage(hwnd,SCI_CANCEL,0,0); SendMessage(hwnd,SCI_SETUNDOCOLLECTION,0,0); UndoRedoSelectionMap(-1,NULL); @@ -464,26 +465,22 @@ BOOL EditConvertText(HWND hwnd,int encSource,int encDest,BOOL bSetSavePoint) if (bSetSavePoint) SendMessage(hwnd,SCI_SETSAVEPOINT,0,0); } - else { - UINT cpSrc = Encoding_SciGetCodePage(hwnd); // fixed internal - UINT cpDst = mEncoding[encDest].uCodePage; - - if (cpSrc == cpDst) - return(TRUE); - - const int chLen = length * 5 + 2; + const int chLen = length * 5 + 1; pchText = GlobalAlloc(GPTR,chLen); tr.lpstrText = pchText; SendMessage(hwnd,SCI_GETTEXTRANGE,0,(LPARAM)&tr); - const int wchLen = length * 3 + 2; + const int wchLen = length * 3 + 1; pwchText = GlobalAlloc(GPTR,wchLen); - cbwText = MultiByteToWideChar(cpSrc,0,pchText,length,pwchText,wchLen); - cbText = WideCharToMultiByte(cpDst,0,pwchText,cbwText,pchText,chLen,NULL,NULL); + // MultiBytes(Sci) -> WideChar(destination) -> Sci(MultiByte) + UINT cpSci = Encoding_SciGetCodePage(hwnd); // fixed internal + UINT cpDst = mEncoding[encDest].uCodePage; + cbwText = MultiByteToWideChar(cpDst,0,pchText,length,pwchText,wchLen); + cbText = WideCharToMultiByte(cpSci,0,pwchText,cbwText,pchText,chLen,NULL,NULL); SendMessage(hwnd,SCI_CANCEL,0,0); SendMessage(hwnd,SCI_SETUNDOCOLLECTION,0,0); From 08f03ba26c7386803ff7d46ccc3690496e0f9d03 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Fri, 6 Oct 2017 17:53:07 +0200 Subject: [PATCH 2/4] + code comment for completeness --- src/Edit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Edit.c b/src/Edit.c index 5ff61c06a..6f891724a 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -477,7 +477,8 @@ BOOL EditConvertText(HWND hwnd,int encSource,int encDest,BOOL bSetSavePoint) pwchText = GlobalAlloc(GPTR,wchLen); // MultiBytes(Sci) -> WideChar(destination) -> Sci(MultiByte) - UINT cpSci = Encoding_SciGetCodePage(hwnd); // fixed internal + //UINT cpSci = mEncoding[encSource].uCodePage; + UINT cpSci = Encoding_SciGetCodePage(hwnd); // fixed Scintilla internal UINT cpDst = mEncoding[encDest].uCodePage; cbwText = MultiByteToWideChar(cpDst,0,pchText,length,pwchText,wchLen); cbText = WideCharToMultiByte(cpSci,0,pwchText,cbwText,pchText,chLen,NULL,NULL); From 33911ca092850cf68d009634126b842de32d4193 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sun, 8 Oct 2017 00:23:44 +0200 Subject: [PATCH 3/4] +fix: broken NormalizePathEx() --- src/Helpers.c | 2 +- src/Notepad3.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Helpers.c b/src/Helpers.c index db410f1ba..d968c5aaf 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -1541,7 +1541,7 @@ void ExpandEnvironmentStringsEx(LPWSTR lpSrc,DWORD dwSrc) void PathCanonicalizeEx(LPWSTR lpszPath,int len) { WCHAR szDst[FILE_ARG_BUF] = { L'\0' }; - if (PathCchCanonicalize(szDst,len,lpszPath)) + if (PathCchCanonicalize(szDst,len,lpszPath) == S_OK) StringCchCopy(lpszPath,len,szDst); } diff --git a/src/Notepad3.c b/src/Notepad3.c index c14991f21..dc73cce25 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -6508,6 +6508,7 @@ void ParseCommandLine() StringCchCopyN(szIniFile,COUNTOF(szIniFile),lp1,len); TrimString(szIniFile); PathUnquoteSpaces(szIniFile); + NormalizePathEx(szIniFile,COUNTOF(szIniFile)); } break; @@ -6988,6 +6989,8 @@ int TestIniFile() { } } } + + NormalizePathEx(szIniFile,COUNTOF(szIniFile)); if (!PathFileExists(szIniFile) || PathIsDirectory(szIniFile)) { StringCchCopy(szIniFile2,COUNTOF(szIniFile2),szIniFile); From 7e91dbfae3dec9270cb3fce4d9cc81c23f7b8139 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sun, 8 Oct 2017 14:38:14 +0200 Subject: [PATCH 4/4] + fix: binary directory to build portable app --- np3portableapp/build_np3portableapp.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/np3portableapp/build_np3portableapp.cmd b/np3portableapp/build_np3portableapp.cmd index 6a463423d..14c0124f0 100644 --- a/np3portableapp/build_np3portableapp.cmd +++ b/np3portableapp/build_np3portableapp.cmd @@ -31,7 +31,7 @@ setlocal :: ==================================================================================================================== :: --- Environment --- -set VERSION=2.0.2.422 +set VERSION=2.17.1008.550 set SCRIPT_DIR=%~dp0 set PORTAPP_ROOT_DIR=D:\PortableApps @@ -39,8 +39,8 @@ set PORTAPP_LAUNCHER_CREATOR=%PORTAPP_ROOT_DIR%\PortableApps.comLauncher\Portabl set PORTAPP_INSTALLER_CREATOR=%PORTAPP_ROOT_DIR%\PortableApps.comInstaller\PortableApps.comInstaller.exe set NP3_DISTRIB_DIR=%SCRIPT_DIR%..\distrib -set NP3_WIN32_DIR=%SCRIPT_DIR%..\Bin\Release_x86_v141_xp -set NP3_X64_DIR=%SCRIPT_DIR%..\Bin\Release_x64_v141_xp +set NP3_WIN32_DIR=%SCRIPT_DIR%..\Bin\Release_x86_v141 +set NP3_X64_DIR=%SCRIPT_DIR%..\Bin\Release_x64_v141 set NP3_PORTAPP_DIR=%SCRIPT_DIR%Notepad3Portable set NP3_PORTAPP_INFO=%NP3_PORTAPP_DIR%\App\AppInfo\appinfo