Fix breaking of the cloned file status after Notepad++ restart

Fix #16412, close #16440
This commit is contained in:
xomx 2025-04-17 21:55:28 +02:00 committed by Don Ho
parent b324a68bc6
commit a449c5e804

View File

@ -2552,7 +2552,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
isWow64Off = true; isWow64Off = true;
} }
#endif #endif
if (doesFileExist(pFn)) if (doesFileExist(pFn) || (isSnapshotMode && doesFileExist(session._subViewFiles[k]._backupFilePath.c_str())))
{ {
//check if already open in main. If so, clone //check if already open in main. If so, clone
BufferID clonedBuf = _mainDocTab.findBufferByName(pFn); BufferID clonedBuf = _mainDocTab.findBufferByName(pFn);
@ -2569,10 +2569,6 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding); lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding);
} }
} }
else if (isSnapshotMode && doesFileExist(session._subViewFiles[k]._backupFilePath.c_str()))
{
lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding, session._subViewFiles[k]._backupFilePath.c_str(), session._subViewFiles[k]._originalFileLastModifTimestamp);
}
else else
{ {
BufferID foundBufID = MainFileManager.getBufferFromName(pFn); BufferID foundBufID = MainFileManager.getBufferFromName(pFn);