From 40ede699cc4d86a8251fc987803d541769c7610f Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Wed, 4 Jan 2023 17:42:22 +0100 Subject: [PATCH 01/13] + Upd: Version files and Changes.txt --- Build/Changes.txt | 8 ++++++-- Versions/day.txt | 2 +- res/Notepad3.exe.conf.manifest | 2 +- src/VersionEx.h | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Build/Changes.txt b/Build/Changes.txt index 4af798a46..eaa5618fc 100644 --- a/Build/Changes.txt +++ b/Build/Changes.txt @@ -34,7 +34,7 @@ UCD - (UCD)ARDET is an Encoding Detector Library ======================================================== -Current BETA/RC Version 5.23.103.(build_#) (2023-01-03) +Current BETA/RC Version 5.23.104.(build_#) (2023-01-04) ======================================================== -------------------------------------------------------- @@ -64,6 +64,8 @@ NEW: CHANGES: -------------------------------------------------------- [.###.#]- . +[.104.1]- Minor refactoring on UpdateUI. +[.104.1]- Move DefaultWindowPosition to Window section (deprecated: Settings2 section). [.101.1]- Refactoring and fix window positioning respecting monitor DPI. [1230.1]- Revert to Lexilla's standard Markdown lexer (LEX). [1230.1]- Change background color for Heading 1 to enhance contrast to std Hyperlink (LEX). @@ -77,6 +79,7 @@ CHANGES: [1216.1]- Replacing SCI_REPLACETARGET calls by SCI_REPLACETARGETMINIMAL calls where appropriate. [1212.1]- Extend AutoCloseBrackets (by Matteo-Nigro PR #4318) for Selection. [1118.2]- Using new AviSynth+ keyword lists and AviSynth colors (light/dark mode). +[1029.1]- Refactored of undo/redo and document modify handler. [1020.1]- Standard DarkMode Theme. [1020.1]- Minor adjustment of grepWinNP3's layout and correction of some strings (GRE). [1018.1]- Simplify WordList Set according to (https://github.com/ScintillaOrg/lexilla/issues/103). @@ -118,6 +121,8 @@ CHANGES Versions in Tools or Libraries: FIXES: -------------------------------------------------------- [.###.#]- . +[.104.1]- Handling of editing own settings (in this case: disable file watching). +[.104.1]- Path to module relative representation. [.103.1]- Load Toolbar-Bitmap handling. [.102.1]- Minor design change and some fixes for Margin and Bookmark handling. [1230.1]- Minor bugs related to new feature Change-History. @@ -138,7 +143,6 @@ FIXES: [1104.1]- Modification marker based on selection history. [1104.1]- Disable events from edit-window while in Begin/End-WaitCursor. [1102.1]- Error message on loading empty file. -[1029.1]- Refactored of undo/redo and document modify handler. [1028.1]- Broken reload file (broken by check for single file instance)". [1023.1]- A warning message in "dialogs_xx_yy.rc". [1020.1]- Respect single file instance mode for internal file loading. diff --git a/Versions/day.txt b/Versions/day.txt index a9c8fe829..b16e5f75e 100644 --- a/Versions/day.txt +++ b/Versions/day.txt @@ -1 +1 @@ -103 +104 diff --git a/res/Notepad3.exe.conf.manifest b/res/Notepad3.exe.conf.manifest index cfed28c33..adace0644 100644 --- a/res/Notepad3.exe.conf.manifest +++ b/res/Notepad3.exe.conf.manifest @@ -3,7 +3,7 @@ diff --git a/src/VersionEx.h b/src/VersionEx.h index aed7df4e1..9b36bb24b 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define SAPPNAME "Notepad3" #define VERSION_MAJOR 5 #define VERSION_MINOR 23 -#define VERSION_REV 103 +#define VERSION_REV 104 #define VERSION_BUILD 1 #define SCINTILLA_VER 532 #define LEXILLA_VER 521 From 4fb266a1e631810b0542e0181e299b05beb87d79 Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Wed, 4 Jan 2023 19:15:22 +0100 Subject: [PATCH 02/13] MUI - Move "DefaultWindowPosition" to [Window] --- Readme.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Readme.md b/Readme.md index 6d028af37..680d7fdd1 100644 --- a/Readme.md +++ b/Readme.md @@ -181,12 +181,6 @@ Specify the default directory for the open and save dialogs, used if no file is Specify the default extension for saved files (omit the leading dot, just like txt or html). -#### `DefaultWindowPosition=` - -This items are managed by Notepad3. (`Menu->View->Position->Save as Default Position`) -(Will set current window position as "Default Position" - can be recalled by `Ctrl+Shift+P` Hotkey) - - #### `DenyVirtualSpaceAccess=0` #### `filebrowser.exe=minipath.exe` @@ -205,7 +199,6 @@ If you don't like it, you can configure e.g. - [Settings2] filebrowser.exe=Explorer++.exe (https://explorerplusplus.com/) (side-by-side Notepad3), or - [Settings2] filebrowser.exe=Q-Dir_x64+.exe (https://www.softwareok.de/?seite=Freeware/Q-Dir/) (side-by-side Notepad3) - #### `grepWin.exe=grepWinNP3.exe` We have integrated a powerful external tool called **grepWinNP3**. @@ -560,4 +553,13 @@ This section offers the possibility to display the name of the function to the r 30=Search in Files ``` + +## **`[Window]`** + +#### `x DefaultWindowPosition=` + +This items are managed by Notepad3. (`Menu->View->Position->Save as Default Position`) +(Will set current window position as "Default Position" - can be recalled by `Ctrl+Shift+P` Hotkey) + +
From 99e541f0c057129a14debd3d548353742b562ad1 Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Wed, 4 Jan 2023 19:48:05 +0100 Subject: [PATCH 03/13] MUI - Update "SettingsVersion" --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 680d7fdd1..66b579827 100644 --- a/Readme.md +++ b/Readme.md @@ -89,7 +89,7 @@ or a to have user-specific settings: These settings are read and written by Notepad3’s user interface. For example, all Menu ? Settings will go here. -#### `SettingsVersion=4` +#### `SettingsVersion=5` #### `Favorites=%APPDATA%\Rizonesoft\Notepad3\Favorites\` From 92dd43f6baafa36913a790db70edd2fc1fb0ec9d Mon Sep 17 00:00:00 2001 From: Stephan Paternotte Date: Thu, 5 Jan 2023 18:16:26 +0100 Subject: [PATCH 04/13] Update strings_nl_nl.rc --- language/np3_nl_nl/strings_nl_nl.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/np3_nl_nl/strings_nl_nl.rc b/language/np3_nl_nl/strings_nl_nl.rc index 86a7e66d5..72de74fb9 100644 --- a/language/np3_nl_nl/strings_nl_nl.rc +++ b/language/np3_nl_nl/strings_nl_nl.rc @@ -174,7 +174,7 @@ BEGIN IDS_MUI_REPLCOUNT "%s exempla(a)r(en) van het opgegeven zoekpatroon vervangen." IDS_MUI_ASK_ENCODING "Bij het omzetten van de ene naar de andere codering kan niet-ondersteunde tekst worden vervangen door standaardtekens. Dit kan niet ongedaan worden. Doorgaan?" IDS_MUI_ASK_ENCODING2 "Je staat op het punt de codering van een leeg bestand te wijzigen. Dit kan niet ongedaan worden. Doorgaan?" - IDS_MUI_ASK_CLEAR_UNDO "This operation will clear the undo history. Continue?" + IDS_MUI_ASK_CLEAR_UNDO "Deze actie zal de geschiedenis wissen. Doorgaan?" IDS_MUI_READONLY_SAVE """%s"" is alleen-lezen. Opslaan als een ander bestand?" IDS_MUI_FILECHANGENOTIFY "Het huidige bestand is gewijzigd door een extern programma. Opnieuw laden?" From 2b6dd6fb3f411d16ab763f45f14f7034153fbc21 Mon Sep 17 00:00:00 2001 From: Matteo-Nigro Date: Thu, 5 Jan 2023 18:19:57 +0100 Subject: [PATCH 05/13] New strings translated --- language/np3_it_it/lexer_it_it.rc | 2 +- language/np3_it_it/strings_it_it.rc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/language/np3_it_it/lexer_it_it.rc b/language/np3_it_it/lexer_it_it.rc index f9b8008d3..031684740 100644 --- a/language/np3_it_it/lexer_it_it.rc +++ b/language/np3_it_it/lexer_it_it.rc @@ -496,7 +496,7 @@ BEGIN IDS_LEX_STR_63387 "Operatore Simbolo" IDS_LEX_STR_63388 "Stringa EOL" IDS_LEX_STR_63397 "Backticks" - IDS_LEX_STR_63398 "GUID String" + IDS_LEX_STR_63398 "Stringa GUID" END STRINGTABLE diff --git a/language/np3_it_it/strings_it_it.rc b/language/np3_it_it/strings_it_it.rc index 8602ea319..7e9b779e0 100644 --- a/language/np3_it_it/strings_it_it.rc +++ b/language/np3_it_it/strings_it_it.rc @@ -174,7 +174,7 @@ BEGIN IDS_MUI_REPLCOUNT "%s occorrenze del pattern di ricerca specificato sono state sostituite." IDS_MUI_ASK_ENCODING "Cambiare la codifica del file potrebbe sostituire testo non supportato con un carattere di default, e la cronologia delle modifiche (undo) sarà svuotata. Continuare?" IDS_MUI_ASK_ENCODING2 "Stai per cambiare la codifica di un file vuoto. Questo cancellerà la cronologia delle modifiche (undo), perché non può essere sincronizzata con la nuova codifica. Continuare?" - IDS_MUI_ASK_CLEAR_UNDO "This operation will clear the undo history. Continue?" + IDS_MUI_ASK_CLEAR_UNDO "Questa operazione cancella la cronologia delle modifiche. Continuare?" IDS_MUI_READONLY_SAVE """%s"" è in sola lettura. Salvare in un file differente?" IDS_MUI_FILECHANGENOTIFY "Il file corrente è stato modificato da un programma esterno. Ricaricare?" From d552699f024d0409df95ac6a69a7acad1f3a209c Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Thu, 5 Jan 2023 18:30:11 +0100 Subject: [PATCH 06/13] MUI - Minor translations in "es-ES" and "es-MX" --- language/np3_es_es/menu_es_es.rc | 4 ++-- language/np3_es_es/strings_es_es.rc | 2 +- language/np3_es_mx/menu_es_mx.rc | 4 ++-- language/np3_es_mx/strings_es_mx.rc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/language/np3_es_es/menu_es_es.rc b/language/np3_es_es/menu_es_es.rc index fd17aa05a..ab22c3832 100644 --- a/language/np3_es_es/menu_es_es.rc +++ b/language/np3_es_es/menu_es_es.rc @@ -469,8 +469,8 @@ BEGIN MENUITEM "Configuración &ajuste de línea...", IDM_SET_WORDWRAPSETTINGS MENUITEM "Configuración de &larga línea...", IDM_SET_LONGLINESETTINGS MENUITEM "&Sangría texto automático", IDM_SET_AUTOINDENTTEXT - MENUITEM "Auto Close Brackets", IDM_SET_AUTOCLOSEBRACKETS - MENUITEM "Auto Cierre &HTML/XML\tCtrl+Shift+H", IDM_SET_AUTOCLOSETAGS + MENUITEM "Auto cierre corchetes", IDM_SET_AUTOCLOSEBRACKETS + MENUITEM "Auto cierre &HTML/XML\tCtrl+Shift+H", IDM_SET_AUTOCLOSETAGS MENUITEM "A&uto completar palabras", IDM_SET_AUTOCOMPLETEWORDS MENUITEM "Auto completar palabras clave 'Le&xer'", IDM_SET_AUTOCLEXKEYWORDS MENUITEM "Se¶dores alternativos de palabra\tCtrl+Alt+A", IDM_SET_ALTERNATE_WORD_SEPS diff --git a/language/np3_es_es/strings_es_es.rc b/language/np3_es_es/strings_es_es.rc index eabcf6cb7..fc140b780 100644 --- a/language/np3_es_es/strings_es_es.rc +++ b/language/np3_es_es/strings_es_es.rc @@ -174,7 +174,7 @@ BEGIN IDS_MUI_REPLCOUNT "Se han reemplazado %s ocurrencia(s) del patrón de búsqueda especificado." IDS_MUI_ASK_ENCODING "Cambiar la codificación del archivo de una codificación a otra puede reemplazar el texto no compatible con caracteres predeterminados, y el historial de deshacer se borrará. ¿Continuar?" IDS_MUI_ASK_ENCODING2 "Está a punto de cambiar la codificación de un archivo vacío. Tenga en cuenta que esto borrará el historial de deshacer, ya que no se puede sincronizar con la nueva codificación. ¿Continuar?" - IDS_MUI_ASK_CLEAR_UNDO "This operation will clear the undo history. Continue?" + IDS_MUI_ASK_CLEAR_UNDO "Esta operación borrará el historial de deshacer. ¿Continuar?" IDS_MUI_READONLY_SAVE """%s"" es de sólo lectura. ¿Guardar en un archivo diferente?" IDS_MUI_FILECHANGENOTIFY "El archivo actual ha sido modificado por un programa externo. ¿Recargar?" diff --git a/language/np3_es_mx/menu_es_mx.rc b/language/np3_es_mx/menu_es_mx.rc index bda674e4d..1541202ef 100644 --- a/language/np3_es_mx/menu_es_mx.rc +++ b/language/np3_es_mx/menu_es_mx.rc @@ -469,8 +469,8 @@ BEGIN MENUITEM "Configuración &ajuste de línea...", IDM_SET_WORDWRAPSETTINGS MENUITEM "Configuración de &larga línea...", IDM_SET_LONGLINESETTINGS MENUITEM "&Sangría texto automático", IDM_SET_AUTOINDENTTEXT - MENUITEM "Auto Close Brackets", IDM_SET_AUTOCLOSEBRACKETS - MENUITEM "Auto Cierre &HTML/XML\tCtrl+Shift+H", IDM_SET_AUTOCLOSETAGS + MENUITEM "Auto cierre corchetes", IDM_SET_AUTOCLOSEBRACKETS + MENUITEM "Auto cierre &HTML/XML\tCtrl+Shift+H", IDM_SET_AUTOCLOSETAGS MENUITEM "A&uto completar palabras", IDM_SET_AUTOCOMPLETEWORDS MENUITEM "Auto completar palabras clave 'Le&xer'", IDM_SET_AUTOCLEXKEYWORDS MENUITEM "Se¶dores alternativos de palabra\tCtrl+Alt+A", IDM_SET_ALTERNATE_WORD_SEPS diff --git a/language/np3_es_mx/strings_es_mx.rc b/language/np3_es_mx/strings_es_mx.rc index 119b6bb3a..ca8f3e159 100644 --- a/language/np3_es_mx/strings_es_mx.rc +++ b/language/np3_es_mx/strings_es_mx.rc @@ -174,7 +174,7 @@ BEGIN IDS_MUI_REPLCOUNT "Se han reemplazado %s ocurrencia(s) del patrón de búsqueda especificado." IDS_MUI_ASK_ENCODING "Cambiar la codificación del archivo de una codificación a otra puede reemplazar el texto no compatible con caracteres predeterminados, y el historial de deshacer se borrará. ¿Continuar?" IDS_MUI_ASK_ENCODING2 "Está a punto de cambiar la codificación de un archivo vacío. Tenga en cuenta que esto borrará el historial de deshacer, ya que no se puede sincronizar con la nueva codificación. ¿Continuar?" - IDS_MUI_ASK_CLEAR_UNDO "This operation will clear the undo history. Continue?" + IDS_MUI_ASK_CLEAR_UNDO "Esta operación borrará el historial de deshacer. ¿Continuar?" IDS_MUI_READONLY_SAVE """%s"" es de sólo lectura. ¿Guardar en un archivo diferente?" IDS_MUI_FILECHANGENOTIFY "El archivo actual ha sido modificado por un programa externo. ¿Recargar?" From 4c98f971f43071d1779f126b05ae35e2238b289a Mon Sep 17 00:00:00 2001 From: LIU Hao Date: Fri, 6 Jan 2023 01:38:55 +0800 Subject: [PATCH 07/13] Update translation for zh_CN and zh_TW --- language/np3_zh_cn/strings_zh_cn.rc | 4 ++-- language/np3_zh_tw/strings_zh_tw.rc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/language/np3_zh_cn/strings_zh_cn.rc b/language/np3_zh_cn/strings_zh_cn.rc index cd8f0cdfd..64a6de75b 100644 --- a/language/np3_zh_cn/strings_zh_cn.rc +++ b/language/np3_zh_cn/strings_zh_cn.rc @@ -174,7 +174,7 @@ BEGIN IDS_MUI_REPLCOUNT "替换了 %s 个匹配项。" IDS_MUI_ASK_ENCODING "切换文件编码可能导致部分无法表示的字符被替换为其它字符,并且该操作会清空撤销历史。是否继续?" IDS_MUI_ASK_ENCODING2 "切换文件编码会清空撤销历史。是否继续?" - IDS_MUI_ASK_CLEAR_UNDO "This operation will clear the undo history. Continue?" + IDS_MUI_ASK_CLEAR_UNDO "该操作将会清空撤销历史。是否继续?" IDS_MUI_READONLY_SAVE "“%s”是只读的。是否尝试使用其它名字保存?" IDS_MUI_FILECHANGENOTIFY "当前文件已被其它程序修改。是否重新加载?" @@ -317,7 +317,7 @@ Notepad3 [/?] [...[编码]] [...[换行符模式]] [/e] [/g] [/m] [/l]\r\n\ /n\t总是打开新窗口(/ns 对于每个文件只允许打开一个实例)。\r\n\ /r\t重用已存在的窗口(/rs 对于每个文件只允许打开一个实例)。\r\n\ /p\t设置窗口位置和大小(/p0,/ps,/pd,f,l,t,r,b,m)\r\n\ -\t或 /p <左>,<上>,<宽>,<高>[,,<最大化>] [均为整数]。\r\n\ +\t或 /p <左>,<上>,<宽>,<高>[,,<最大化>] [均为整数]。\r\n\ /t\t设置窗口标题。\r\n\ /i\t以托盘图标状态启动。\r\n\ /o\t窗口置顶。\r\n\ diff --git a/language/np3_zh_tw/strings_zh_tw.rc b/language/np3_zh_tw/strings_zh_tw.rc index 416841f08..bd4e9acb0 100644 --- a/language/np3_zh_tw/strings_zh_tw.rc +++ b/language/np3_zh_tw/strings_zh_tw.rc @@ -174,7 +174,7 @@ BEGIN IDS_MUI_REPLCOUNT "%s 次出現的指定搜索模式已被替換。" IDS_MUI_ASK_ENCODING "切換檔案編碼可能導致部分無法表示的字元被替換為其它字元,並且該操作會清空取消歷程記錄。是否繼續?" IDS_MUI_ASK_ENCODING2 "切換檔案編碼會清空取消歷程記錄。是否繼續?" - IDS_MUI_ASK_CLEAR_UNDO "This operation will clear the undo history. Continue?" + IDS_MUI_ASK_CLEAR_UNDO "該操作將會清空取消歷程記錄。是否繼續?" IDS_MUI_READONLY_SAVE """%s"" 是唯讀。是否嘗試使用其它名字儲存?" IDS_MUI_FILECHANGENOTIFY "目前檔案已被其它程式修改。是否重新載入?" @@ -317,7 +317,7 @@ Notepad3 [/?] [...[編碼]] [...[分行符號模式]] [/e] [/g] [/m] [/l]\r\n\ /n\t總是開啟新視窗(/ns 對於每個檔案只允許開啟一個實例)。\r\n\ /r\t重新使用已存在的視窗(/rs 對於每個檔案只允許開啟一個實例)。\r\n\ /p\t設定視窗位置和大小(/p0,/ps,/pd,f,l,t,r,b,m)\r\n\ -\t或 /p <左>,<上>,<寬>,<高>[,,<最大化>] [均為整數]。\r\n\ +\t或 /p <左>,<上>,<寬>,<高>[,,<最大化>] [均為整數]。\r\n\ /t\t設定視窗標題。\r\n\ /i\t以系統匣圖示狀態啟動。\r\n\ /o\t視窗置頂。\r\n\ From 46ce82894bd57ae38159b1da34191a71c4de0fdf Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Thu, 5 Jan 2023 18:46:37 +0100 Subject: [PATCH 08/13] +fix: fix some WSL2 (Linux) path issues --- src/Notepad3.c | 787 ++++++++++++++++++++++++++----------------------- src/PathLib.c | 63 ++-- src/PathLib.h | 2 +- 3 files changed, 453 insertions(+), 399 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index 534a292e5..291a5d887 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -9045,7 +9045,11 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) // // ParseCommandLine() // -// + +static void ParseCmdLnOption(LPWSTR lp1, LPWSTR lp2, const size_t len); // forward decl + +//============================================================================= + void ParseCommandLine() { LPWSTR lpCmdLine = GetCommandLine(); @@ -9056,13 +9060,12 @@ void ParseCommandLine() // Good old console can also send args separated by Tabs StrTab2Space(lpCmdLine); - DocPos const len = (DocPos)(StringCchLenW(lpCmdLine,0) + 2UL); + size_t const len = StringCchLenW(lpCmdLine,0) + 2UL; LPWSTR const lp1 = AllocMem(sizeof(WCHAR)*len,HEAP_ZERO_MEMORY); LPWSTR const lp2 = AllocMem(sizeof(WCHAR)*len,HEAP_ZERO_MEMORY); LPWSTR const lp3 = AllocMem(sizeof(WCHAR)*len,HEAP_ZERO_MEMORY); if (lp1 && lp2 && lp3) { - bool bIsNotepadReplacement = false; // Start with 2nd argument ExtractFirstArgument(lpCmdLine, lp1, lp3, (int)len); @@ -9076,368 +9079,28 @@ void ParseCommandLine() if (!bIsFileArg && (lp1[0] == L'+') && (lp1[1] == L'\0')) { Globals.CmdLnFlag_MultiFileArg = 2; bIsFileArg = true; - } else if (!bIsFileArg && (lp1[0] == L'-') && (lp1[1] == L'\0')) { + StringCchCopy(lp3, len, lp2); // next arg + } + else if (!bIsFileArg && (lp1[0] == L'-') && (lp1[1] == L'\0')) { Globals.CmdLnFlag_MultiFileArg = 1; bIsFileArg = true; - } else if (!bIsFileArg && ((*lp1 == L'/') || (*lp1 == L'-'))) { - // LTrim - StrLTrimI(lp1, L"-/"); - - // 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; - } else if (StringCchCompareXI(lp1, L"UNICODE") == 0 || StringCchCompareXI(lp1, L"W") == 0) { - s_flagSetEncoding = CPI_UNICODEBOM; - } else if (StringCchCompareXI(lp1, L"UNICODEBE") == 0 || StringCchCompareXI(lp1, L"UNICODE-BE") == 0) { - s_flagSetEncoding = CPI_UNICODEBEBOM; - } else if (StringCchCompareXI(lp1, L"UTF8") == 0 || StringCchCompareXI(lp1, L"UTF-8") == 0) { - s_flagSetEncoding = CPI_UTF8; - } else if (StringCchCompareXI(lp1, L"UTF8SIG") == 0 || StringCchCompareXI(lp1, L"UTF-8SIG") == 0 || - StringCchCompareXI(lp1, L"UTF8SIGNATURE") == 0 || StringCchCompareXI(lp1, L"UTF-8SIGNATURE") == 0 || - StringCchCompareXI(lp1, L"UTF8-SIGNATURE") == 0 || StringCchCompareXI(lp1, L"UTF-8-SIGNATURE") == 0) { - s_flagSetEncoding = CPI_UTF8SIGN; - } - // maybe parsed encoding - else if (Encoding_IsValid(encoding)) { - 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; - } else if (StringCchCompareXI(lp1, L"CR") == 0) { - s_flagSetEOLMode = IDM_LINEENDINGS_CR - IDM_LINEENDINGS_CRLF + 1; - } else if (StringCchCompareXI(lp1, L"LF") == 0) { - s_flagSetEOLMode = IDM_LINEENDINGS_LF - IDM_LINEENDINGS_CRLF + 1; - } - // Shell integration - else if (StrCmpNI(lp1, L"appid=", CONSTSTRGLEN(L"appid=")) == 0) { - StringCchCopyN(Settings2.AppUserModelID, COUNTOF(Settings2.AppUserModelID), - lp1 + CONSTSTRGLEN(L"appid="), len - CONSTSTRGLEN(L"appid=")); - StrTrim(Settings2.AppUserModelID, L" "); - if (StrIsEmpty(Settings2.AppUserModelID)) { - StringCchCopy(Settings2.AppUserModelID, COUNTOF(Settings2.AppUserModelID), _W("Rizonesoft.") _W(SAPPNAME)); - } - } else if (StrCmpNI(lp1, L"sysmru=", CONSTSTRGLEN(L"sysmru=")) == 0) { - WCHAR wch[16]; - StringCchCopyN(wch, COUNTOF(wch), lp1 + CONSTSTRGLEN(L"sysmru="), COUNTOF(wch)); - StrTrim(wch, L" "); - if (*wch == L'1') { - Globals.CmdLnFlag_ShellUseSystemMRU = 2; - } else { - Globals.CmdLnFlag_ShellUseSystemMRU = 1; - } - } - // Relaunch elevated - else if (StrCmpNI(lp1, RELAUNCH_ELEVATED_BUF_ARG, CONSTSTRGLEN(RELAUNCH_ELEVATED_BUF_ARG)) == 0) { - Path_Reset(s_hpthRelaunchElevatedFile, lp1 + CONSTSTRGLEN(RELAUNCH_ELEVATED_BUF_ARG)); - //?TrimSpcW(s_hpthRelaunchElevatedFile); - Path_NormalizeEx(s_hpthRelaunchElevatedFile, Paths.ModuleDirectory, true, Flags.bSearchPathIfRelative); - s_IsThisAnElevatedRelaunch = true; - } - - else { - - switch (*CharUpper(lp1)) { - - case L'N': - Globals.CmdLnFlag_ReuseWindow = 1; - if (*CharUpper(lp1 + 1) == L'S') { - Globals.CmdLnFlag_SingleFileInstance = 2; - } else { - Globals.CmdLnFlag_SingleFileInstance = 1; - } - break; - - case L'R': - if (*CharUpper(lp1 + 1) == L'P') { - Flags.bPreserveFileModTime = true; - } else { - Globals.CmdLnFlag_ReuseWindow = 2; - if (*CharUpper(lp1 + 1) == L'S') { - Globals.CmdLnFlag_SingleFileInstance = 2; - } else { - Globals.CmdLnFlag_SingleFileInstance = 1; - } - } - break; - - case L'F': - if (*(lp1 + 1) == L'0' || *CharUpper(lp1 + 1) == L'O') { - Path_Reset(Paths.IniFile, L"*?"); - } else if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { - WCHAR wchPath[INTERNET_MAX_URL_LENGTH]; - StringCchCopyN(wchPath, COUNTOF(wchPath), lp1, len); - Path_Reset(Paths.IniFile, wchPath); - Path_NormalizeEx(Paths.IniFile, Paths.ModuleDirectory, true, false); - } - break; - - case L'I': - s_flagStartAsTrayIcon = true; - break; - - case L'O': - if (*(lp1 + 1) == L'0' || *(lp1 + 1) == L'-' || *CharUpper(lp1 + 1) == L'O') { - Globals.CmdLnFlag_AlwaysOnTop = 1; - } else { - Globals.CmdLnFlag_AlwaysOnTop = 2; - } - break; - - case L'P': { - WCHAR* lp = lp1; - if (StrCmpNI(lp1, L"POS:", CONSTSTRGLEN(L"POS:")) == 0) { - lp += CONSTSTRGLEN(L"POS:") - 1; - } else if (StrCmpNI(lp1, L"POS", CONSTSTRGLEN(L"POS")) == 0) { - lp += CONSTSTRGLEN(L"POS") - 1; - } else if (*(lp1 + 1) == L':') { - lp += 1; - } else if (bIsNotepadReplacement) { - if (*(lp1 + 1) == L'T') { - ExtractFirstArgument(lp2, lp1, lp2, (int)len); - } - break; - } - if (*(lp + 1) == L'0' || *CharUpper(lp + 1) == L'O') { - Globals.CmdLnFlag_PosParam = true; - Globals.CmdLnFlag_WindowPos = 1; - } else if (*CharUpper(lp + 1) == L'D' || *CharUpper(lp + 1) == L'S') { - Globals.CmdLnFlag_PosParam = true; - Globals.CmdLnFlag_WindowPos = (StrChrI((lp + 1), L'L')) ? 3 : 2; - } else if (StrChrI(L"FLTRBM", *(lp + 1))) { - WCHAR* p = (lp + 1); - Globals.CmdLnFlag_PosParam = true; - Globals.CmdLnFlag_WindowPos = 0; - while (*p) { - switch (*CharUpper(p)) { - case L'F': - Globals.CmdLnFlag_WindowPos &= ~(4 | 8 | 16 | 32); - Globals.CmdLnFlag_WindowPos |= 64; - break; - case L'L': - Globals.CmdLnFlag_WindowPos &= ~(8 | 64); - Globals.CmdLnFlag_WindowPos |= 4; - break; - case L'R': - Globals.CmdLnFlag_WindowPos &= ~(4 | 64); - Globals.CmdLnFlag_WindowPos |= 8; - break; - case L'T': - Globals.CmdLnFlag_WindowPos &= ~(32 | 64); - Globals.CmdLnFlag_WindowPos |= 16; - break; - case L'B': - Globals.CmdLnFlag_WindowPos &= ~(16 | 64); - Globals.CmdLnFlag_WindowPos |= 32; - break; - case L'M': - if (Globals.CmdLnFlag_WindowPos == 0) { - Globals.CmdLnFlag_WindowPos |= 64; - } - Globals.CmdLnFlag_WindowPos |= 128; - break; - } - p = CharNext(p); - } - } else if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { - WININFO wi = INIT_WININFO; - int iMaximize = 0; - int const itok = swscanf_s(lp1, WINDOWPOS_STRGFORMAT, &wi.x, &wi.y, &wi.cx, &wi.cy, &wi.dpi, &iMaximize); - if (itok == 4 || itok == 5 || itok == 6) { // scan successful - Globals.CmdLnFlag_PosParam = true; - Globals.CmdLnFlag_WindowPos = 0; - if (itok == 4) { - wi.dpi = USER_DEFAULT_SCREEN_DPI; - iMaximize = 0; - } - else if (itok == 5) { // maybe DPI or Maxi (old) - if (wi.dpi < (USER_DEFAULT_SCREEN_DPI >> 2)) { - iMaximize = wi.dpi; - wi.dpi = USER_DEFAULT_SCREEN_DPI; - } - else { - iMaximize = 0; - } - } - wi.max = !!iMaximize; - g_IniWinInfo = wi; // set window placement - } - } - } - break; - - case L'T': - if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { - StringCchCopyN(s_wchTitleExcerpt, COUNTOF(s_wchTitleExcerpt), lp1, len); - s_flagKeepTitleExcerpt = true; - } - break; - - case L'C': - s_flagNewFromClipboard = true; - break; - - case L'B': - s_flagPasteBoard = true; - break; - - case L'E': - if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { - s_flagSetEncoding = Encoding_MatchW(lp1); - } - break; - - case L'G': - if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { - int itok = - swscanf_s(lp1, L"%i,%i", &s_iInitialLine, &s_iInitialColumn); - if (itok == 1 || itok == 2) { // scan successful - s_flagJumpTo = true; - } - } - break; - - case L'M': { - bool bFindUp = false; - bool bMatchCase = false; - bool bRegex = false; - bool bDotMatchAll = false; - bool bTransBS = false; - - if (StrChr(lp1, L'-')) { - bFindUp = true; - } - if (StrChr(lp1, L'C')) { - bMatchCase = true; - } - if (StrChr(lp1, L'R')) { - bRegex = true; - bTransBS = true; - } - if (StrChr(lp1, L'A')) { - bDotMatchAll = true; - } - if (StrChr(lp1, L'B')) { - bTransBS = true; - } - if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { - SetFindPattern(lp1); - - g_flagMatchText = 1; - if (bFindUp) { - g_flagMatchText |= 2; - } - if (bRegex) { - g_flagMatchText |= 4; - } - if (bMatchCase) { - g_flagMatchText |= 8; - } - if (bDotMatchAll) { - g_flagMatchText |= 16; - } - if (bTransBS) { - g_flagMatchText |= 32; - } - } - } - break; - - case L'L': - if (*(lp1 + 1) == L'0' || *(lp1 + 1) == L'-' || *CharUpper(lp1 + 1) == L'O') { - s_flagChangeNotify = FWM_MSGBOX; - } else if (*(lp1 + 1) == L'1' || *(lp1 + 1) == L'+' || *CharUpper(lp1 + 1) == L'X') { - s_flagChangeNotify = FWM_EXCLUSIVELOCK; - } else { - s_flagChangeNotify = FWM_AUTORELOAD; - } - break; - - case L'Q': - if (*CharUpper(lp1 + 1) == L'S') { - s_flagSaveOnRelaunch = true; - } else { - s_flagQuietCreate = true; - } - break; - - case L'S': - if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { - if (s_lpSchemeArg) { - LocalFree(s_lpSchemeArg); // StrDup() - s_lpSchemeArg = NULL; - } - s_lpSchemeArg = StrDup(lp1); - s_flagLexerSpecified = true; - } - break; - - case L'D': - if (s_lpSchemeArg) { - LocalFree(s_lpSchemeArg); // StrDup() - s_lpSchemeArg = NULL; - } - s_iInitialLexer = 0; - s_flagLexerSpecified = true; - break; - - case L'H': - if (s_lpSchemeArg) { - LocalFree(s_lpSchemeArg); // StrDup() - s_lpSchemeArg = NULL; - } - s_iInitialLexer = 35; - s_flagLexerSpecified = true; - break; - - case L'X': - if (s_lpSchemeArg) { - LocalFree(s_lpSchemeArg); // StrDup() - s_lpSchemeArg = NULL; - } - s_iInitialLexer = 36; - s_flagLexerSpecified = true; - break; - - case L'U': - if (*CharUpper(lp1 + 1) == L'C') { - s_flagAppIsClosing = true; - } else { - Flags.bDoRelaunchElevated = true; - } - break; - - case L'Y': - Flags.bSearchPathIfRelative = true; - break; - - case L'Z': - ExtractFirstArgument(lp2, lp1, lp2, (int)len); - Globals.CmdLnFlag_MultiFileArg = 1; - bIsNotepadReplacement = true; - break; - - case L'?': - s_flagDisplayHelp = true; - break; - - case L'V': - Globals.CmdLnFlag_PrintFileAndLeave = 1; - if (*CharUpper(lp1 + 1) == L'D') { - Globals.CmdLnFlag_PrintFileAndLeave = 2; // open printer dialog - } - break; - - default: - break; - - } - } + StringCchCopy(lp3, len, lp2); // next arg + } + else if (!bIsFileArg && ((*lp1 == L'/') && (*lp2 == '\0'))) { + bIsFileArg = true; + // lp3 must be file, so not ~StringCchCopy(lp3, len, lp2) + } + else if (!bIsFileArg && ((*lp1 == L'/') || (*lp1 == L'-'))) { + StrLTrimI(lp1, L"-/"); // LeftTrim + ParseCmdLnOption(lp1, lp2, len); + bIsFileArg = false; + } + else { + bIsFileArg = true; } // pathname - else { + if (bIsFileArg) { + LPWSTR const lpFileBuf = AllocMem(sizeof(WCHAR) * len, HEAP_ZERO_MEMORY); if (lpFileBuf) { @@ -9448,20 +9111,22 @@ void ParseCommandLine() FreeMem(s_lpOrigFileArg); s_lpOrigFileArg = NULL; } - s_lpOrigFileArg = AllocMem(sizeof(WCHAR)*(fileArgLen + 1), HEAP_ZERO_MEMORY); // changed for ActivatePrevInst() needs - StringCchCopy(s_lpOrigFileArg, fileArgLen + 1, lp3); + size_t const alloc_spc = sizeof(WCHAR) * (fileArgLen + 1); + s_lpOrigFileArg = AllocMem(alloc_spc, HEAP_ZERO_MEMORY); // changed for ActivatePrevInst() needs + StringCchCopy(s_lpOrigFileArg, alloc_spc, lp3); Path_Reset(s_pthArgFilePath, lp3); - //assert(false); - //if (!Path_IsRelative(s_pthArgFilePath) && !Path_IsUNC(s_pthArgFilePath) && (Path_GetDriveNumber(s_pthArgFilePath) == -1)) - //{ - // HPATHL pthAdjustPath = Path_Copy(Paths.WorkingDirectory); - // Path_StripToRoot(pthAdjustPath); - // Path_Append(pthAdjustPath, Path_Get(s_pthArgFilePath)); - // Path_Reset(s_pthArgFilePath, Path_Get(pthAdjustPath)); - // Path_Release(pthAdjustPath); - //} + Path_FixBackslashes(s_pthArgFilePath); + + if (!Path_IsRelative(s_pthArgFilePath) && !Path_IsUNC(s_pthArgFilePath) && (Path_GetDriveNumber(s_pthArgFilePath) == -1)) + { + HPATHL pthAdjustPath = Path_Copy(Paths.WorkingDirectory); + Path_StripToRoot(pthAdjustPath); + Path_Append(pthAdjustPath, Path_Get(s_pthArgFilePath)); + Path_Reset(s_pthArgFilePath, Path_Get(pthAdjustPath)); + Path_Release(pthAdjustPath); + } Path_NormalizeEx(s_pthArgFilePath, Paths.WorkingDirectory, true, true); @@ -9489,6 +9154,384 @@ void ParseCommandLine() } } +static void ParseCmdLnOption(LPWSTR lp1, LPWSTR lp2, const size_t len) +{ + static bool bIsNotepadReplacement = false; + + // 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; + } + else if (StringCchCompareXI(lp1, L"UNICODE") == 0 || StringCchCompareXI(lp1, L"W") == 0) { + s_flagSetEncoding = CPI_UNICODEBOM; + } + else if (StringCchCompareXI(lp1, L"UNICODEBE") == 0 || StringCchCompareXI(lp1, L"UNICODE-BE") == 0) { + s_flagSetEncoding = CPI_UNICODEBEBOM; + } + else if (StringCchCompareXI(lp1, L"UTF8") == 0 || StringCchCompareXI(lp1, L"UTF-8") == 0) { + s_flagSetEncoding = CPI_UTF8; + } + else if (StringCchCompareXI(lp1, L"UTF8SIG") == 0 || StringCchCompareXI(lp1, L"UTF-8SIG") == 0 || + StringCchCompareXI(lp1, L"UTF8SIGNATURE") == 0 || StringCchCompareXI(lp1, L"UTF-8SIGNATURE") == 0 || + StringCchCompareXI(lp1, L"UTF8-SIGNATURE") == 0 || StringCchCompareXI(lp1, L"UTF-8-SIGNATURE") == 0) { + s_flagSetEncoding = CPI_UTF8SIGN; + } + // maybe parsed encoding + else if (Encoding_IsValid(encoding)) { + 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; + } + else if (StringCchCompareXI(lp1, L"CR") == 0) { + s_flagSetEOLMode = IDM_LINEENDINGS_CR - IDM_LINEENDINGS_CRLF + 1; + } + else if (StringCchCompareXI(lp1, L"LF") == 0) { + s_flagSetEOLMode = IDM_LINEENDINGS_LF - IDM_LINEENDINGS_CRLF + 1; + } + // Shell integration + else if (StrCmpNI(lp1, L"appid=", CONSTSTRGLEN(L"appid=")) == 0) { + StringCchCopyN(Settings2.AppUserModelID, COUNTOF(Settings2.AppUserModelID), + lp1 + CONSTSTRGLEN(L"appid="), len - CONSTSTRGLEN(L"appid=")); + StrTrim(Settings2.AppUserModelID, L" "); + if (StrIsEmpty(Settings2.AppUserModelID)) { + StringCchCopy(Settings2.AppUserModelID, COUNTOF(Settings2.AppUserModelID), _W("Rizonesoft.") _W(SAPPNAME)); + } + } + else if (StrCmpNI(lp1, L"sysmru=", CONSTSTRGLEN(L"sysmru=")) == 0) { + WCHAR wch[16]; + StringCchCopyN(wch, COUNTOF(wch), lp1 + CONSTSTRGLEN(L"sysmru="), COUNTOF(wch)); + StrTrim(wch, L" "); + if (*wch == L'1') { + Globals.CmdLnFlag_ShellUseSystemMRU = 2; + } + else { + Globals.CmdLnFlag_ShellUseSystemMRU = 1; + } + } + // Relaunch elevated + else if (StrCmpNI(lp1, RELAUNCH_ELEVATED_BUF_ARG, CONSTSTRGLEN(RELAUNCH_ELEVATED_BUF_ARG)) == 0) { + Path_Reset(s_hpthRelaunchElevatedFile, lp1 + CONSTSTRGLEN(RELAUNCH_ELEVATED_BUF_ARG)); + //?TrimSpcW(s_hpthRelaunchElevatedFile); + Path_NormalizeEx(s_hpthRelaunchElevatedFile, Paths.ModuleDirectory, true, Flags.bSearchPathIfRelative); + s_IsThisAnElevatedRelaunch = true; + } + + else { + + switch (*CharUpper(lp1)) { + + case L'N': + Globals.CmdLnFlag_ReuseWindow = 1; + if (*CharUpper(lp1 + 1) == L'S') { + Globals.CmdLnFlag_SingleFileInstance = 2; + } + else { + Globals.CmdLnFlag_SingleFileInstance = 1; + } + break; + + case L'R': + if (*CharUpper(lp1 + 1) == L'P') { + Flags.bPreserveFileModTime = true; + } + else { + Globals.CmdLnFlag_ReuseWindow = 2; + if (*CharUpper(lp1 + 1) == L'S') { + Globals.CmdLnFlag_SingleFileInstance = 2; + } + else { + Globals.CmdLnFlag_SingleFileInstance = 1; + } + } + break; + + case L'F': + if (*(lp1 + 1) == L'0' || *CharUpper(lp1 + 1) == L'O') { + Path_Reset(Paths.IniFile, L"*?"); + } + else if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { + WCHAR wchPath[INTERNET_MAX_URL_LENGTH]; + StringCchCopyN(wchPath, COUNTOF(wchPath), lp1, len); + Path_Reset(Paths.IniFile, wchPath); + Path_NormalizeEx(Paths.IniFile, Paths.ModuleDirectory, true, false); + } + break; + + case L'I': + s_flagStartAsTrayIcon = true; + break; + + case L'O': + if (*(lp1 + 1) == L'0' || *(lp1 + 1) == L'-' || *CharUpper(lp1 + 1) == L'O') { + Globals.CmdLnFlag_AlwaysOnTop = 1; + } + else { + Globals.CmdLnFlag_AlwaysOnTop = 2; + } + break; + + case L'P': { + WCHAR* lp = lp1; + if (StrCmpNI(lp1, L"POS:", CONSTSTRGLEN(L"POS:")) == 0) { + lp += CONSTSTRGLEN(L"POS:") - 1; + } + else if (StrCmpNI(lp1, L"POS", CONSTSTRGLEN(L"POS")) == 0) { + lp += CONSTSTRGLEN(L"POS") - 1; + } + else if (*(lp1 + 1) == L':') { + lp += 1; + } + else if (bIsNotepadReplacement) { + if (*(lp1 + 1) == L'T') { + ExtractFirstArgument(lp2, lp1, lp2, (int)len); + } + break; + } + if (*(lp + 1) == L'0' || *CharUpper(lp + 1) == L'O') { + Globals.CmdLnFlag_PosParam = true; + Globals.CmdLnFlag_WindowPos = 1; + } + else if (*CharUpper(lp + 1) == L'D' || *CharUpper(lp + 1) == L'S') { + Globals.CmdLnFlag_PosParam = true; + Globals.CmdLnFlag_WindowPos = (StrChrI((lp + 1), L'L')) ? 3 : 2; + } + else if (StrChrI(L"FLTRBM", *(lp + 1))) { + WCHAR* p = (lp + 1); + Globals.CmdLnFlag_PosParam = true; + Globals.CmdLnFlag_WindowPos = 0; + while (*p) { + switch (*CharUpper(p)) { + case L'F': + Globals.CmdLnFlag_WindowPos &= ~(4 | 8 | 16 | 32); + Globals.CmdLnFlag_WindowPos |= 64; + break; + case L'L': + Globals.CmdLnFlag_WindowPos &= ~(8 | 64); + Globals.CmdLnFlag_WindowPos |= 4; + break; + case L'R': + Globals.CmdLnFlag_WindowPos &= ~(4 | 64); + Globals.CmdLnFlag_WindowPos |= 8; + break; + case L'T': + Globals.CmdLnFlag_WindowPos &= ~(32 | 64); + Globals.CmdLnFlag_WindowPos |= 16; + break; + case L'B': + Globals.CmdLnFlag_WindowPos &= ~(16 | 64); + Globals.CmdLnFlag_WindowPos |= 32; + break; + case L'M': + if (Globals.CmdLnFlag_WindowPos == 0) { + Globals.CmdLnFlag_WindowPos |= 64; + } + Globals.CmdLnFlag_WindowPos |= 128; + break; + } + p = CharNext(p); + } + } + else if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { + WININFO wi = INIT_WININFO; + int iMaximize = 0; + int const itok = swscanf_s(lp1, WINDOWPOS_STRGFORMAT, &wi.x, &wi.y, &wi.cx, &wi.cy, &wi.dpi, &iMaximize); + if (itok == 4 || itok == 5 || itok == 6) { // scan successful + Globals.CmdLnFlag_PosParam = true; + Globals.CmdLnFlag_WindowPos = 0; + if (itok == 4) { + wi.dpi = USER_DEFAULT_SCREEN_DPI; + iMaximize = 0; + } + else if (itok == 5) { // maybe DPI or Maxi (old) + if (wi.dpi < (USER_DEFAULT_SCREEN_DPI >> 2)) { + iMaximize = wi.dpi; + wi.dpi = USER_DEFAULT_SCREEN_DPI; + } + else { + iMaximize = 0; + } + } + wi.max = !!iMaximize; + g_IniWinInfo = wi; // set window placement + } + } + } break; + + case L'T': + if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { + StringCchCopyN(s_wchTitleExcerpt, COUNTOF(s_wchTitleExcerpt), lp1, len); + s_flagKeepTitleExcerpt = true; + } + break; + + case L'C': + s_flagNewFromClipboard = true; + break; + + case L'B': + s_flagPasteBoard = true; + break; + + case L'E': + if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { + s_flagSetEncoding = Encoding_MatchW(lp1); + } + break; + + case L'G': + if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { + int itok = + swscanf_s(lp1, L"%i,%i", &s_iInitialLine, &s_iInitialColumn); + if (itok == 1 || itok == 2) { // scan successful + s_flagJumpTo = true; + } + } + break; + + case L'M': { + bool bFindUp = false; + bool bMatchCase = false; + bool bRegex = false; + bool bDotMatchAll = false; + bool bTransBS = false; + + if (StrChr(lp1, L'-')) { + bFindUp = true; + } + if (StrChr(lp1, L'C')) { + bMatchCase = true; + } + if (StrChr(lp1, L'R')) { + bRegex = true; + bTransBS = true; + } + if (StrChr(lp1, L'A')) { + bDotMatchAll = true; + } + if (StrChr(lp1, L'B')) { + bTransBS = true; + } + if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { + SetFindPattern(lp1); + + g_flagMatchText = 1; + if (bFindUp) { + g_flagMatchText |= 2; + } + if (bRegex) { + g_flagMatchText |= 4; + } + if (bMatchCase) { + g_flagMatchText |= 8; + } + if (bDotMatchAll) { + g_flagMatchText |= 16; + } + if (bTransBS) { + g_flagMatchText |= 32; + } + } + } break; + + case L'L': + if (*(lp1 + 1) == L'0' || *(lp1 + 1) == L'-' || *CharUpper(lp1 + 1) == L'O') { + s_flagChangeNotify = FWM_MSGBOX; + } + else if (*(lp1 + 1) == L'1' || *(lp1 + 1) == L'+' || *CharUpper(lp1 + 1) == L'X') { + s_flagChangeNotify = FWM_EXCLUSIVELOCK; + } + else { + s_flagChangeNotify = FWM_AUTORELOAD; + } + break; + + case L'Q': + if (*CharUpper(lp1 + 1) == L'S') { + s_flagSaveOnRelaunch = true; + } + else { + s_flagQuietCreate = true; + } + break; + + case L'S': + if (ExtractFirstArgument(lp2, lp1, lp2, (int)len)) { + if (s_lpSchemeArg) { + LocalFree(s_lpSchemeArg); // StrDup() + s_lpSchemeArg = NULL; + } + s_lpSchemeArg = StrDup(lp1); + s_flagLexerSpecified = true; + } + break; + + case L'D': + if (s_lpSchemeArg) { + LocalFree(s_lpSchemeArg); // StrDup() + s_lpSchemeArg = NULL; + } + s_iInitialLexer = 0; + s_flagLexerSpecified = true; + break; + + case L'H': + if (s_lpSchemeArg) { + LocalFree(s_lpSchemeArg); // StrDup() + s_lpSchemeArg = NULL; + } + s_iInitialLexer = 35; + s_flagLexerSpecified = true; + break; + + case L'X': + if (s_lpSchemeArg) { + LocalFree(s_lpSchemeArg); // StrDup() + s_lpSchemeArg = NULL; + } + s_iInitialLexer = 36; + s_flagLexerSpecified = true; + break; + + case L'U': + if (*CharUpper(lp1 + 1) == L'C') { + s_flagAppIsClosing = true; + } + else { + Flags.bDoRelaunchElevated = true; + } + break; + + case L'Y': + Flags.bSearchPathIfRelative = true; + break; + + case L'Z': + ExtractFirstArgument(lp2, lp1, lp2, (int)len); + Globals.CmdLnFlag_MultiFileArg = 1; + bIsNotepadReplacement = true; + break; + + case L'?': + s_flagDisplayHelp = true; + break; + + case L'V': + Globals.CmdLnFlag_PrintFileAndLeave = 1; + if (*CharUpper(lp1 + 1) == L'D') { + Globals.CmdLnFlag_PrintFileAndLeave = 2; // open printer dialog + } + break; + + default: + break; + } + } +} + //============================================================================= // diff --git a/src/PathLib.c b/src/PathLib.c index 41dac7a43..88e5375af 100644 --- a/src/PathLib.c +++ b/src/PathLib.c @@ -793,6 +793,37 @@ void PTHAPI Path_FreeExtra(HPATHL hpth_in_out, size_t keep_length) // ---------------------------------------------------------------------------- +//============================================================================= +// +// PathFixBackslashes() - in place conversion +// +bool PTHAPI Path_FixBackslashes(HPATHL hpth_in_out) +{ + HSTRINGW hstr_io = ToHStrgW(hpth_in_out); // inplace hpth_in_out + if (!hstr_io) + return false; + + LPWSTR const lpsz = StrgWriteAccessBuf(hstr_io, 0); + + WCHAR* c = lpsz; + bool bFixed = false; + while ((c = StrChr(c, L'/')) != NULL) { + if (c != lpsz && c[-1] == L':' && c[1] == L'/') { + c += 2; + } + else { + *c++ = L'\\'; + bFixed = true; + } + } + //~StrgSanitize(hstr_io); : '/' replaced by '\' only + return bFixed; +} + + +//============================================================================= + + // With untrusted input, this function by itself, cannot be used to convert // paths into a form that can be compared with other paths for sub-path or identity. // Callers that need that ability should convert forward to back slashes before @@ -803,6 +834,7 @@ bool PTHAPI Path_Canonicalize(HPATHL hpth_in_out) if (!hpth_in_out) { return false; } + Path_FixBackslashes(hpth_in_out); HPATHL hpth_cpy = Path_Allocate(PathGet(hpth_in_out)); HSTRINGW hstr_cpy = ToHStrgW(hpth_cpy); @@ -965,29 +997,6 @@ int PTHAPI Path_StrgComparePath(const HPATHL hpth1, const HPATHL hpth2, const HP // ---------------------------------------------------------------------------- -bool PTHAPI Path_RemoveBackslash(HPATHL hpth_in_out) -{ - HSTRINGW hstr_io = ToHStrgW(hpth_in_out); - if (!hstr_io) - return false; - - LPWSTR wbuf = StrgWriteAccessBuf(hstr_io, 0); // no need to ReAlloc - //size_t const cch = StrgGetAllocLength(hstr_io); - size_t const hstr_len = StrgGetLength(hstr_io); - - ///bool const res = SUCCEEDED(PathXCchRemoveBackslashEx(wbuf, cch, NULL, NULL)); - if (hstr_len > 0) { - if ((wbuf[hstr_len - 1] == L'/') || (wbuf[hstr_len - 1] == L'\\')) { - wbuf[hstr_len] = L'\0'; - } - } - StrgSanitize(hstr_io); - - return true; -} -// ---------------------------------------------------------------------------- - - bool PTHAPI Path_RemoveFileSpec(HPATHL hpth_in_out) { HSTRINGW hstr_io = ToHStrgW(hpth_in_out); @@ -1790,6 +1799,8 @@ bool PTHAPI Path_CanonicalizeEx(HPATHL hpth_in_out, const HPATHL hdir_rel_base) HSTRINGW hstr_io = ToHStrgW(hpth_in_out); if (!hstr_io) return false; + + Path_FixBackslashes(hpth_in_out); if (StrgFind(hstr_io, PATH_CSIDL_MYDOCUMENTS, 0) == 0) { @@ -1814,7 +1825,6 @@ bool PTHAPI Path_CanonicalizeEx(HPATHL hpth_in_out, const HPATHL hdir_rel_base) else { res = Path_Canonicalize(hpth_in_out); } - Path_RemoveBackslash(hpth_in_out); return res; } @@ -1831,6 +1841,8 @@ size_t PTHAPI Path_NormalizeEx(HPATHL hpth_in_out, const HPATHL hpth_wrkdir, boo if (!hstr_io) return false; + Path_FixBackslashes(hpth_in_out); + ExpandEnvironmentStrgs(hstr_io, true); if (_Path_IsRelative(hpth_in_out)) { @@ -1993,7 +2005,6 @@ static bool _Path_RelativePathTo(HPATHL hrecv, const HPATHL hfrom, DWORD attr_fr for (size_t d = 0; d < dir_cnt; ++d) { StringCchCatW(hrecv_buf, len, PATHPARENT_PREFIX); } - //~Path_RemoveBackslash(hpath_in_out); if ((hto_buf[prefix] == L'\\') || (hto_buf[prefix] == L'/')) { ++prefix; } @@ -2116,7 +2127,7 @@ void PTHAPI ExpandEnvironmentStrgs(HSTRINGW hstr_in_out, bool bStripQ) StrgTrim(hstr_in_out, L'\''); } - //StrgReplace(hstr_in_out, L"~", L"%USERPROFILE%"); + StrgReplace(hstr_in_out, L"~", L"%USERPROFILE%"); size_t const min_len = ExpandEnvironmentStrings(StrgGet(hstr_in_out), NULL, 0); LPWSTR buf_io = StrgWriteAccessBuf(hstr_in_out, min_len); diff --git a/src/PathLib.h b/src/PathLib.h index 58c6c7785..7714fb822 100644 --- a/src/PathLib.h +++ b/src/PathLib.h @@ -91,6 +91,7 @@ bool PTHAPI Path_Append(HPATHL hpth, LPCWSTR more); void PTHAPI Path_Swap(HPATHL hpth1, HPATHL hpth2); void PTHAPI Path_FreeExtra(HPATHL hpth_in_out, size_t keep_length); +bool PTHAPI Path_FixBackslashes(HPATHL hpth_in_out); bool PTHAPI Path_Canonicalize(HPATHL hpth_in_out); bool PTHAPI Path_IsEmpty(const HPATHL hpth); inline bool PTHAPI Path_IsNotEmpty(const HPATHL hpth) { return !Path_IsEmpty(hpth); }; @@ -100,7 +101,6 @@ bool PTHAPI Path_IsExistingDirectory(const HPATHL hpth); int PTHAPI Path_StrgComparePathNormalized(const HPATHL hpth1, const HPATHL hpth2); int PTHAPI Path_StrgComparePath(const HPATHL hpth1, const HPATHL hpth2, const HPATHL hpth_wrkdir); -bool PTHAPI Path_RemoveBackslash(HPATHL hpth_in_out); bool PTHAPI Path_RemoveFileSpec(HPATHL hpth_in_out); bool PTHAPI Path_RenameExtension(HPATHL hpth, LPCWSTR ext); void PTHAPI Path_ExpandEnvStrings(HPATHL hpth_in_out); From f344d36431f4b9be1036af50712bc05c48165438 Mon Sep 17 00:00:00 2001 From: Akos Keresztes Date: Thu, 5 Jan 2023 20:08:33 +0100 Subject: [PATCH 09/13] Hungarian translation update --- language/np3_hu_hu/menu_hu_hu.rc | 2 +- language/np3_hu_hu/strings_hu_hu.rc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/language/np3_hu_hu/menu_hu_hu.rc b/language/np3_hu_hu/menu_hu_hu.rc index 1b74cabf5..bf48a85c1 100644 --- a/language/np3_hu_hu/menu_hu_hu.rc +++ b/language/np3_hu_hu/menu_hu_hu.rc @@ -473,7 +473,7 @@ BEGIN MENUITEM "HTML/&XML aut. lezárás\tCtrl+Shift+H", IDM_SET_AUTOCLOSETAGS MENUITEM "Szó kie&gészítés", IDM_SET_AUTOCOMPLETEWORDS MENUITEM "Lexer kul&csszavak kiegészítése", IDM_SET_AUTOCLEXKEYWORDS - MENUITEM "Alternate Word Se¶tors\tCtrl+Alt+A", IDM_SET_ALTERNATE_WORD_SEPS + MENUITEM "Szó el&választók váltása\tCtrl+Alt+A", IDM_SET_ALTERNATE_WORD_SEPS MENUITEM SEPARATOR MENUITEM "Egy &példány fájlonként", IDM_SET_SINGLEFILEINSTANCE MENUITEM "Figyel&meztetés fájl változásról...\tAlt+F5", IDM_SET_CHANGENOTIFY diff --git a/language/np3_hu_hu/strings_hu_hu.rc b/language/np3_hu_hu/strings_hu_hu.rc index 9c1c071d0..725c4a120 100644 --- a/language/np3_hu_hu/strings_hu_hu.rc +++ b/language/np3_hu_hu/strings_hu_hu.rc @@ -174,7 +174,7 @@ BEGIN IDS_MUI_REPLCOUNT "A keresési minta %s db. találata cserélve lett." IDS_MUI_ASK_ENCODING "A fájl kódolásának megváltoztatása lecserélhet nem támogatott karaktereket alapértelmezettek karakterekkel, valamint a visszavonási történet törölve lesz. Folytatja?" IDS_MUI_ASK_ENCODING2 "Egy üres fájl kódolását változtatja meg. Ne feledje, hogy ez a visszavonási történetet törli, mert azt nem lehet szinkronizálni az új kódolással. Folytatja?" - IDS_MUI_ASK_CLEAR_UNDO "This operation will clear the undo history. Continue?" + IDS_MUI_ASK_CLEAR_UNDO "Ez a művelet törli a visszavonási előzményeket. Folytatja?" IDS_MUI_READONLY_SAVE """%s"" csak olvastható. Legyen mentés egy másik fájlba?" IDS_MUI_FILECHANGENOTIFY "Az aktuális fájl egy külső progarm által módosítva lett. Újratöltsük?" From 1c43606f88600aa8a52d98a468bbd546da16fc87 Mon Sep 17 00:00:00 2001 From: Pairi Daiza Date: Thu, 5 Jan 2023 20:18:30 +0100 Subject: [PATCH 10/13] + Upd: Version files and Changes.txt --- Build/Changes.txt | 3 ++- Versions/day.txt | 2 +- res/Notepad3.exe.conf.manifest | 2 +- src/VersionEx.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Build/Changes.txt b/Build/Changes.txt index eaa5618fc..7068a97e3 100644 --- a/Build/Changes.txt +++ b/Build/Changes.txt @@ -34,7 +34,7 @@ UCD - (UCD)ARDET is an Encoding Detector Library ======================================================== -Current BETA/RC Version 5.23.104.(build_#) (2023-01-04) +Current BETA/RC Version 5.23.105.(build_#) (2023-01-05) ======================================================== -------------------------------------------------------- @@ -121,6 +121,7 @@ CHANGES Versions in Tools or Libraries: FIXES: -------------------------------------------------------- [.###.#]- . +[.104.1]- Fix some WSL2 (Linux) path issues. [.104.1]- Handling of editing own settings (in this case: disable file watching). [.104.1]- Path to module relative representation. [.103.1]- Load Toolbar-Bitmap handling. diff --git a/Versions/day.txt b/Versions/day.txt index b16e5f75e..f96ac0672 100644 --- a/Versions/day.txt +++ b/Versions/day.txt @@ -1 +1 @@ -104 +105 diff --git a/res/Notepad3.exe.conf.manifest b/res/Notepad3.exe.conf.manifest index adace0644..240db5353 100644 --- a/res/Notepad3.exe.conf.manifest +++ b/res/Notepad3.exe.conf.manifest @@ -3,7 +3,7 @@ diff --git a/src/VersionEx.h b/src/VersionEx.h index 9b36bb24b..8bad95c2d 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define SAPPNAME "Notepad3" #define VERSION_MAJOR 5 #define VERSION_MINOR 23 -#define VERSION_REV 104 +#define VERSION_REV 105 #define VERSION_BUILD 1 #define SCINTILLA_VER 532 #define LEXILLA_VER 521 From 83a08f1124f86bbda5e8e2f47ee87f034cc40661 Mon Sep 17 00:00:00 2001 From: maboroshin <41102508+maboroshin@users.noreply.github.com> Date: Fri, 6 Jan 2023 06:32:37 +0900 Subject: [PATCH 11/13] Translation >Japanese : 2023 RC2 --- language/np3_ja_jp/lexer_ja_jp.rc | 2 +- language/np3_ja_jp/strings_ja_jp.rc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/language/np3_ja_jp/lexer_ja_jp.rc b/language/np3_ja_jp/lexer_ja_jp.rc index 90c96d4e1..7b588a813 100644 --- a/language/np3_ja_jp/lexer_ja_jp.rc +++ b/language/np3_ja_jp/lexer_ja_jp.rc @@ -496,7 +496,7 @@ BEGIN IDS_LEX_STR_63387 "Symbol Operator" IDS_LEX_STR_63388 "文字列 EOL" IDS_LEX_STR_63397 "Backticks" - IDS_LEX_STR_63398 "GUID String" + IDS_LEX_STR_63398 "GUID 文字列" END STRINGTABLE diff --git a/language/np3_ja_jp/strings_ja_jp.rc b/language/np3_ja_jp/strings_ja_jp.rc index 654ac60b5..0bcf74bf9 100644 --- a/language/np3_ja_jp/strings_ja_jp.rc +++ b/language/np3_ja_jp/strings_ja_jp.rc @@ -172,9 +172,9 @@ BEGIN IDS_MUI_FIND_WRAPRE "文書の先頭に到達しました。終端から検索しますか?" IDS_MUI_NOTFOUND "指定の検索条件には一致しませんでした。" IDS_MUI_REPLCOUNT "一致する %s か所を指定の検索条件で置換しました。" - IDS_MUI_ASK_ENCODING "他の文字コードに変換すると、未対応の文字は所定の文字に置換され、また「元に戻す」の履歴もリセットされます。\n変換を続行しますか?" - IDS_MUI_ASK_ENCODING2 "空のファイルの文字コードを変更しようとしています。「元に戻す」の履歴もリセットされます。変更を続行しますか?" - IDS_MUI_ASK_CLEAR_UNDO "This operation will clear the undo history. Continue?" + IDS_MUI_ASK_ENCODING "他の文字コードに変換すると、未対応の文字は所定の文字に置換され、また「元に戻す」の履歴が消去されます。\n変換を続行しますか?" + IDS_MUI_ASK_ENCODING2 "空のファイルの文字コードを変更しようとしています。「元に戻す」の履歴が消去されます。変更を続行しますか?" + IDS_MUI_ASK_CLEAR_UNDO "この操作は「元に戻す」の履歴を消去します。続行しますか?" IDS_MUI_READONLY_SAVE "「%s」は読み取り専用です。別のファイル名で保存しますか?" IDS_MUI_FILECHANGENOTIFY "ファイルが他のプログラムによって変更されました。再読み込みしますか?" From bce7d1dc27e749f350bb24c0aa0414b17bcdf511 Mon Sep 17 00:00:00 2001 From: Matteo-Nigro Date: Fri, 6 Jan 2023 00:06:28 +0100 Subject: [PATCH 12/13] Updated menu item Improved translation --- language/np3_it_it/menu_it_it.rc | 2 +- language/np3_it_it/strings_it_it.rc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/language/np3_it_it/menu_it_it.rc b/language/np3_it_it/menu_it_it.rc index e1548dfd7..f886e9683 100644 --- a/language/np3_it_it/menu_it_it.rc +++ b/language/np3_it_it/menu_it_it.rc @@ -397,7 +397,7 @@ BEGIN POPUP "&Folding" BEGIN MENUITEM "Code &Folding", IDM_VIEW_FOLDING - MENUITEM "&Attiva/Disattiva Folds\tCtrl+Alt+F", IDM_VIEW_TOGGLEFOLDS + MENUITEM "Esp&andi/Collassa tutti i Folds\tCtrl+Alt+F", IDM_VIEW_TOGGLEFOLDS MENUITEM SEPARATOR MENUITEM "Salta al Prossimo Fold\tAlt+ +", CMD_FOLDJUMPDOWN MENUITEM "Salta al Precedente Fold\tAlt+ –", CMD_FOLDJUMPUP diff --git a/language/np3_it_it/strings_it_it.rc b/language/np3_it_it/strings_it_it.rc index 7e9b779e0..35e465da8 100644 --- a/language/np3_it_it/strings_it_it.rc +++ b/language/np3_it_it/strings_it_it.rc @@ -83,7 +83,7 @@ BEGIN IDT_FILE_PRINT "Stampa" IDT_FILE_OPENFAV "Preferiti" IDT_FILE_ADDTOFAV "Aggiungi ai Preferiti" - IDT_VIEW_TOGGLEFOLDS "Attiva/disattiva Folding" + IDT_VIEW_TOGGLEFOLDS "Espandi/Collassa tutti i Folds" END STRINGTABLE From 6c59635ce13f1f57a2fb0ca0ae472727a9b9db88 Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Fri, 6 Jan 2023 01:31:04 +0100 Subject: [PATCH 13/13] +fix: not intended replacement of "~" used in short windows path names --- src/PathLib.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/PathLib.c b/src/PathLib.c index 88e5375af..bd4c4918d 100644 --- a/src/PathLib.c +++ b/src/PathLib.c @@ -2126,9 +2126,6 @@ void PTHAPI ExpandEnvironmentStrgs(HSTRINGW hstr_in_out, bool bStripQ) StrgTrim(hstr_in_out, L'"'); StrgTrim(hstr_in_out, L'\''); } - - StrgReplace(hstr_in_out, L"~", L"%USERPROFILE%"); - size_t const min_len = ExpandEnvironmentStrings(StrgGet(hstr_in_out), NULL, 0); LPWSTR buf_io = StrgWriteAccessBuf(hstr_in_out, min_len); DWORD const cch_io = (DWORD)StrgGetAllocLength(hstr_in_out);