From 6229e0f5d47687ca7be19dad4b32f00edb3f3dbb Mon Sep 17 00:00:00 2001 From: xomx Date: Thu, 28 Nov 2024 16:03:00 +0100 Subject: [PATCH] Fix regression: Drag&drop a folder in Notepad++ launch redundant dialog The regression is introduced by commit: https://github.com/notepad-plus-plus/notepad-plus-plus/commit/c021c861959765db9efa0a7d6b156538a0e6f4db Only returning BUFFER_INVALID in FileManager::loadFile immediately if the file size check == -1. This is a must here because of the following code does not expect such -1 in fileSize. But an error msg is not appropriate here, as it could also be a legal attempt to open a dir (with files inside) or an attempt to use the N++ globbing feature. This early return also speeds up the loading stage a bit. Fix #15869, close #15870 --- PowerEditor/src/ScintillaComponent/Buffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index 9f32cd6a4..5633ff7cd 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -729,7 +729,7 @@ BufferID FileManager::loadFile(const wchar_t* filename, Document doc, int encodi if (fileSize == -1) { // we cannot continue (or Scintilla will throw SC_STATUS_FAILURE in the loadFileData later) - ::MessageBox(_pNotepadPlus->_pEditView->getHSelf(), L"Cannot obtain the file size before loading!", L"File to load size-check failed", MB_OK | MB_APPLMODAL); + // - no error message here as this can be also a dir with files to open or globbing attempt return BUFFER_INVALID; }