From 81649bbd770db3fca43aef2e459034f43f99edf7 Mon Sep 17 00:00:00 2001 From: "METANEOCORTEX\\Kotti" Date: Sun, 2 Feb 2025 20:56:31 +0100 Subject: [PATCH] fix: reload arguments after changing own settings files --- src/Dialogs.c | 4 ++-- src/Notepad3.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Dialogs.c b/src/Dialogs.c index 1bb144d09..724b488b9 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -4864,9 +4864,9 @@ void DialogNewWindow(HWND hwnd, bool bSaveBeforeOpen, const HPATHL hFilePath, WI HPATHL hmod_pth = Path_Allocate(NULL); Path_GetModuleFilePath(hmod_pth); - StringCchPrintf(wch, COUNTOF(wch), L"\"-appid=%s\"", Settings2.AppUserModelID); + StringCchPrintf(wch, COUNTOF(wch), L"-appid=\"%s\"", Settings2.AppUserModelID); HSTRINGW hparam_str = StrgCreate(wch); - StringCchPrintf(wch, COUNTOF(wch), L"\" -sysmru=%i\"", (Flags.ShellUseSystemMRU ? 1 : 0)); + StringCchPrintf(wch, COUNTOF(wch), L" -sysmru=\"%i\"", (Flags.ShellUseSystemMRU ? 1 : 0)); StrgCat(hparam_str, wch); if (Path_IsNotEmpty(Paths.IniFile)) { HPATHL hini_path = Path_Copy(Paths.IniFile); diff --git a/src/Notepad3.c b/src/Notepad3.c index 5c9610404..7190175fc 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -670,6 +670,7 @@ static inline void ResetFileObservationData(const bool bResetEvt) { ZeroMemory(&(s_FileChgObsvrData.fdCurFile), sizeof(WIN32_FIND_DATA)); } } + } // ---------------------------------------------------------------------------- @@ -4787,9 +4788,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) break; - case IDM_FILE_SAVE: - FileSave(FSF_None); - break; + case IDM_FILE_SAVE: { + FileSave((FileWatching.FileWatchingMode <= FWM_DONT_CARE) ? FileSave(FSF_SaveAlways) : FSF_None); + } break; case IDM_FILE_SAVEAS: @@ -9435,6 +9436,8 @@ void ParseCommandLine() LPWSTR const lp2 = AllocMem(sizeof(WCHAR)*len,HEAP_ZERO_MEMORY); LPWSTR const lp3 = AllocMem(sizeof(WCHAR)*len,HEAP_ZERO_MEMORY); + //assert(!"ParseCommandLine() - ATTACH DEBUGGER NOW"); + if (lp1 && lp2 && lp3) { // Start with 2nd argument @@ -9470,6 +9473,7 @@ void ParseCommandLine() bIsFileArg = true; } // pathname + if (bIsFileArg) { LPWSTR const lpFileBuf = AllocMem(sizeof(WCHAR) * len, HEAP_ZERO_MEMORY); @@ -13031,7 +13035,7 @@ void InstallFileWatching(const bool bInstall) { bool const bPrevReadOnlyAttrib = IsFileReadOnly(); if (bPrevReadOnlyAttrib) { - SendWMCommand(Globals.hwndMain, IDM_FILE_READONLY); // try to gain access + PostWMCommand(Globals.hwndMain, IDM_FILE_READONLY); // try to gain access } if (!IsFileReadOnly()) { @@ -13062,7 +13066,7 @@ void InstallFileWatching(const bool bInstall) { } if (bPrevReadOnlyAttrib && !IsFileReadOnly()) { - SendWMCommand(Globals.hwndMain, IDM_FILE_READONLY); // try to reset + PostWMCommand(Globals.hwndMain, IDM_FILE_READONLY); // try to reset } } }