[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

@ -977,6 +977,17 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
{
_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
::SetEvent(writeEvent);
::CloseHandle(writeEvent);
@ -991,6 +1002,15 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
//_pscratchTilla->markSavedLines();
_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
::SetEvent(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_CLEARALL);
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
if (language < L_EXTERNAL)
{
_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;
TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name;
#ifdef UNICODE
const char *pName = wmc->wchar2char(name, CP_ACP);
#else
const char *pName = name;
#endif
_pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, (LPARAM)pName);
}