Browse Source

Fix cloned (modified & unsaved) document disassociated issue after Npp being relaunched

The bug has been fixed in v8.5.7 by PR #14003.
However the fix causes a regression #14164, the concerning commit is reverted.
Hence this fix.

Fix #10266, fix #10365
pull/14455/head
Don Ho 12 months ago
parent
commit
a51e62c16d
  1. 19
      PowerEditor/src/NppIO.cpp

19
PowerEditor/src/NppIO.cpp

@ -2276,17 +2276,21 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
nppParam.safeWow64EnableWow64FsRedirection(FALSE);
isWow64Off = true;
}
if (PathFileExists(pFn))
{
if (isSnapshotMode && session._subViewFiles[k]._backupFilePath != TEXT(""))
lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding, session._subViewFiles[k]._backupFilePath.c_str(), session._subViewFiles[k]._originalFileLastModifTimestamp);
else
lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding);
//check if already open in main. If so, clone
if (_mainDocTab.getIndexByBuffer(lastOpened) != -1)
BufferID clonedBuf = _mainDocTab.findBufferByName(pFn);
if (clonedBuf != BUFFER_INVALID)
{
loadBufferIntoView(clonedBuf, SUB_VIEW);
}
else
{
loadBufferIntoView(lastOpened, SUB_VIEW);
if (isSnapshotMode && session._subViewFiles[k]._backupFilePath != TEXT(""))
lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding, session._subViewFiles[k]._backupFilePath.c_str(), session._subViewFiles[k]._originalFileLastModifTimestamp);
else
lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding);
}
}
else if (isSnapshotMode && PathFileExists(session._subViewFiles[k]._backupFilePath.c_str()))
@ -2299,6 +2303,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, const wch
if (foundBufID == BUFFER_INVALID)
lastOpened = nppGUI._keepSessionAbsentFileEntries ? MainFileManager.newPlaceholderDocument(pFn, SUB_VIEW, userCreatedSessionName) : BUFFER_INVALID;
}
if (isWow64Off)
{
nppParam.safeWow64EnableWow64FsRedirection(TRUE);

Loading…
Cancel
Save