Fix renamed last empty clean tab cannot be closed issue

Fix #15306, close #15312
pull/15314/head
xomx 2024-06-17 00:07:27 +02:00 committed by Don Ho
parent 9a27df8f13
commit ace9f49679
1 changed files with 4 additions and 2 deletions

View File

@ -4626,10 +4626,12 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne)
Buffer * buf = MainFileManager.getBufferByID(id); 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 (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; return false;
} }