Merge branch 'Dev_Master' into Future_Dev_Master

This commit is contained in:
METANEOCORTEX\Kotti 2023-01-06 01:47:13 +01:00
commit bebfd277fc
22 changed files with 493 additions and 435 deletions

View File

@ -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.105.(build_#) (2023-01-05)
========================================================
--------------------------------------------------------
@ -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,9 @@ 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.
[.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 +144,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.

View File

@ -89,7 +89,7 @@ or a to have user-specific settings:
These settings are read and written by Notepad3s user interface.
For example, all Menu ? Settings will go here.
#### `SettingsVersion=4`
#### `SettingsVersion=5`
#### `Favorites=%APPDATA%\Rizonesoft\Notepad3\Favorites\`
@ -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]`**
#### `<ResX>x<ResY> 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)
<hr/>

View File

@ -1 +1 @@
103
105

View File

@ -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&paradores alternativos de palabra\tCtrl+Alt+A", IDM_SET_ALTERNATE_WORD_SEPS

View File

@ -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?"

View File

@ -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&paradores alternativos de palabra\tCtrl+Alt+A", IDM_SET_ALTERNATE_WORD_SEPS

View File

@ -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?"

View File

@ -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&parators\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

View File

@ -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?"

View File

@ -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

View File

@ -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

View File

@ -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
@ -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?"

View File

@ -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

View File

@ -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
"ファイルが他のプログラムによって変更されました。再読み込みしますか?"

View File

@ -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?"

View File

@ -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 <左>,<上>,<宽>,<高>[,<dpi>,<最大化>] [均为整数]。\r\n\
\t或 /p <左>,<上>,<宽>,<高>[,<DPI>,<最大化>] [均为整数]。\r\n\
/t\t设置窗口标题。\r\n\
/i\t以托盘图标状态启动。\r\n\
/o\t窗口置顶。\r\n\

View File

@ -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 <左>,<上>,<寬>,<高>[,<dpi>,<最大化>] [均為整數]。\r\n\
\t或 /p <左>,<上>,<寬>,<高>[,<DPI>,<最大化>] [均為整數]。\r\n\
/t\t設定視窗標題。\r\n\
/i\t以系統匣圖示狀態啟動。\r\n\
/o\t視窗置頂。\r\n\

View File

@ -3,7 +3,7 @@
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity
name="Rizonesoft.Notepad3"
version="5.23.103.1"
version="5.23.105.1"
processorArchitecture="*"
type="win32"
/>

View File

@ -9063,7 +9063,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();
@ -9074,13 +9078,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);
@ -9094,368 +9097,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) {
@ -9466,20 +9129,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);
@ -9507,6 +9172,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;
}
}
}
//=============================================================================
//

View File

@ -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;
}
@ -2115,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);

View File

@ -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);

View File

@ -8,7 +8,7 @@
#define SAPPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 23
#define VERSION_REV 103
#define VERSION_REV 105
#define VERSION_BUILD 1
#define SCINTILLA_VER 532
#define LEXILLA_VER 521