From ace9f49679bb32eae02568c069b6a2e4d77c4a7e Mon Sep 17 00:00:00 2001 From: xomx Date: Mon, 17 Jun 2024 00:07:27 +0200 Subject: [PATCH] Fix renamed last empty clean tab cannot be closed issue Fix #15306, close #15312 --- PowerEditor/src/Notepad_plus.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index e6d8ac33b..89329fd75 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4626,10 +4626,12 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) Buffer * buf = MainFileManager.getBufferByID(id); - //Cannot close doc if last and clean + //Cannot close doc if last and clean and not renamed if (tabToClose->nbItem() == 1) { - if (!buf->isDirty() && buf->isUntitled()) + generic_string newTitle = ((NppParameters::getInstance()).getNativeLangSpeaker())->getLocalizedStrFromID("tab-untitled-string", UNTITLED_STR); + generic_string bufFileName = buf->getFullPathName(); + if (!buf->isDirty() && buf->isUntitled() && bufFileName.starts_with(newTitle.c_str())) { return false; }