mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 22:04:55 +02:00
Make session inaccessible files remembered (part 1/2)
Add the ability of "placrholders" (the empty document) for the inaccessible files of past session. The inaccessible files from the current (default) session (i.e., session.xml) will not be lost in the next startup of Notepad++. Furthermore, if file status detection is enabled in Notepad++ (default setting: ON), and the previously inaccessible files become accessible again (e.g., USB drive is inserted or network drive is remounted), the resurrected files can be reloaded on-the-fly without restarting Notepad++. The user will be prompted to reload if the placeholder is switched in. Fix #12079, fix #12744, fix #13696, close #14168
This commit is contained in:
parent
bbbf3e8dfc
commit
4248c2ae22
@ -2145,7 +2145,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, bool shou
|
||||
}
|
||||
else
|
||||
{
|
||||
lastOpened = BUFFER_INVALID;
|
||||
lastOpened = MainFileManager.newPlaceholderDocument(pFn, MAIN_VIEW);
|
||||
}
|
||||
if (isWow64Off)
|
||||
{
|
||||
@ -2283,7 +2283,7 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, bool shou
|
||||
}
|
||||
else
|
||||
{
|
||||
lastOpened = BUFFER_INVALID;
|
||||
lastOpened = MainFileManager.newPlaceholderDocument(pFn, SUB_VIEW);
|
||||
}
|
||||
if (isWow64Off)
|
||||
{
|
||||
|
@ -1347,6 +1347,15 @@ BufferID FileManager::newEmptyDocument()
|
||||
return id;
|
||||
}
|
||||
|
||||
BufferID FileManager::newPlaceholderDocument(const TCHAR* missingFilename, int whichOne)
|
||||
{
|
||||
BufferID buf = MainFileManager.newEmptyDocument();
|
||||
_pNotepadPlus->loadBufferIntoView(buf, whichOne);
|
||||
buf->setFileName(missingFilename);
|
||||
buf->_currentStatus = DOC_REGULAR;
|
||||
return buf;
|
||||
}
|
||||
|
||||
BufferID FileManager::bufferFromDocument(Document doc, bool isMainEditZone)
|
||||
{
|
||||
NppParameters& nppParamInst = NppParameters::getInstance();
|
||||
|
@ -88,6 +88,8 @@ public:
|
||||
|
||||
BufferID loadFile(const TCHAR * filename, Document doc = static_cast<Document>(NULL), int encoding = -1, const TCHAR *backupFileName = nullptr, FILETIME fileNameTimestamp = {}); //ID == BUFFER_INVALID on failure. If Doc == NULL, a new file is created, otherwise data is loaded in given document
|
||||
BufferID newEmptyDocument();
|
||||
// create an empty placeholder for a missing file when loading session
|
||||
BufferID newPlaceholderDocument(const TCHAR * missingFilename, int whichOne);
|
||||
|
||||
//create Buffer from existing Scintilla, used from new Scintillas.
|
||||
BufferID bufferFromDocument(Document doc, bool isMainEditZone);
|
||||
|
Loading…
x
Reference in New Issue
Block a user