From c4ff9f76a35775b865c01e3ec7142bf222c2d95a Mon Sep 17 00:00:00 2001 From: Don HO Date: Sat, 16 Feb 2019 23:47:03 +0100 Subject: [PATCH] Make "new #" document drag-and-drop operation among instances right. New correct behaviour: Dragging out a "new #" document from instance 1 and dropping it into instance 2 makes disappear "new #" document from instance 1, and nothing happens in instance 2. --- PowerEditor/src/NppIO.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 560aac4c..9d35890f 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -163,9 +163,10 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive, generic_string gs_fileName{fileName}; size_t res = gs_fileName.find_first_of(UNTITLED_STR); - if (res != string::npos && res == 0) + if (res != string::npos && res == 0) // it can happen when a document named "new #", which is dragged from another instance, is dropped into this instance { - fileName2Find = fileName; + // it's meaningless to show empty "new #" document, so just return null + return nullptr; } else {