[BUG_FIXED] Fix session snapshot SaveAll bug.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1238 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-05-15 16:43:56 +00:00
parent dacbb4bc0a
commit e975e06410

View File

@ -976,10 +976,21 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
if (isCopy) if (isCopy)
{ {
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault); _pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
/* for saveAs it's not necessary since this action is for the "current" directory, so we let manage in SAVEPOINTREACHED event
generic_string backupFilePath = buffer->getBackupFileName();
if (backupFilePath != TEXT(""))
{
// delete backup file
generic_string file2Delete = buffer->getBackupFileName();
buffer->setBackupFileName(TEXT(""));
::DeleteFile(file2Delete.c_str());
}
*/
// set to signaled state // set to signaled state
::SetEvent(writeEvent); ::SetEvent(writeEvent);
::CloseHandle(writeEvent); ::CloseHandle(writeEvent);
return true; //all done return true; //all done
} }
@ -991,6 +1002,15 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
//_pscratchTilla->markSavedLines(); //_pscratchTilla->markSavedLines();
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault); _pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
generic_string backupFilePath = buffer->getBackupFileName();
if (backupFilePath != TEXT(""))
{
// delete backup file
generic_string file2Delete = buffer->getBackupFileName();
buffer->setBackupFileName(TEXT(""));
::DeleteFile(file2Delete.c_str());
}
// set to signaled state // set to signaled state
::SetEvent(writeEvent); ::SetEvent(writeEvent);
::CloseHandle(writeEvent); ::CloseHandle(writeEvent);
@ -1130,9 +1150,9 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea
_pscratchTilla->execute(SCI_SETREADONLY, false); _pscratchTilla->execute(SCI_SETREADONLY, false);
} }
_pscratchTilla->execute(SCI_CLEARALL); _pscratchTilla->execute(SCI_CLEARALL);
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
if (language < L_EXTERNAL) if (language < L_EXTERNAL)
{ {
_pscratchTilla->execute(SCI_SETLEXER, ScintillaEditView::langNames[language].lexerID); _pscratchTilla->execute(SCI_SETLEXER, ScintillaEditView::langNames[language].lexerID);
@ -1141,11 +1161,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea
{ {
int id = language - L_EXTERNAL; int id = language - L_EXTERNAL;
TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name; TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name;
#ifdef UNICODE
const char *pName = wmc->wchar2char(name, CP_ACP); const char *pName = wmc->wchar2char(name, CP_ACP);
#else
const char *pName = name;
#endif
_pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, (LPARAM)pName); _pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, (LPARAM)pName);
} }