From 2bdc01429ac0fe490331608eb2aef792bfe01864 Mon Sep 17 00:00:00 2001 From: zufuliu Date: Sun, 3 Dec 2023 20:18:35 +0800 Subject: [PATCH] On clicking, ask to delete non-existing path from MRU list, issue #740. Patch by @Sergy2001 --- src/Dialogs.c | 2 +- src/Notepad2.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Dialogs.c b/src/Dialogs.c index d4109ff124..38a4448d9d 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -1274,8 +1274,8 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR if (!PathIsFile(tch)) { // Ask... if (IDYES == MsgBoxWarn(MB_YESNO, IDS_ERR_MRUDLG)) { - MRU_Delete(pFileMRU, lvi.iItem); MRU_DeleteFileFromStore(pFileMRU, tch); + MRU_Delete(pFileMRU, lvi.iItem); // must use recreate the list, index might change... //ListView_DeleteItem(hwndLV, lvi.iItem); diff --git a/src/Notepad2.c b/src/Notepad2.c index 50effddf1c..39c86d1e17 100644 --- a/src/Notepad2.c +++ b/src/Notepad2.c @@ -5007,7 +5007,12 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) { if (index < MRU_MAXITEMS) { LPCWSTR path = pFileMRU->pszItems[index]; if (path) { - if (FileSave(FileSaveFlag_Ask)) { + if (!PathIsFile(path)) { + if (IDYES == MsgBoxWarn(MB_YESNO, IDS_ERR_MRUDLG)) { + MRU_DeleteFileFromStore(pFileMRU, path); + MRU_Delete(pFileMRU, index); + } + } else if (FileSave(FileSaveFlag_Ask)) { FileLoad(FileLoadFlag_DontSave, path); } }