Fix regression: file can't be saved if it's set to other charset before

Fix #11238
This commit is contained in:
Don Ho 2022-02-18 14:49:21 +01:00
parent 4555db8f91
commit 2321e648ae
2 changed files with 3 additions and 3 deletions

View File

@ -774,7 +774,6 @@ bool FileManager::reloadBuffer(BufferID id)
buf->setLoadedDirty(false); // Since the buffer will be reloaded from the disk, and it will be clean (not dirty), we can set _isLoadedDirty false safetly. buf->setLoadedDirty(false); // Since the buffer will be reloaded from the disk, and it will be clean (not dirty), we can set _isLoadedDirty false safetly.
// Set _isLoadedDirty false before calling "_pscratchTilla->execute(SCI_CLEARALL);" in loadFileData() to avoid setDirty in SCN_SAVEPOINTREACHED / SCN_SAVEPOINTLEFT // Set _isLoadedDirty false before calling "_pscratchTilla->execute(SCI_CLEARALL);" in loadFileData() to avoid setDirty in SCN_SAVEPOINTREACHED / SCN_SAVEPOINTLEFT
buf->_canNotify = false; //disable notify during file load, we don't want dirty status to be triggered
//Get file size //Get file size
FILE* fp = generic_fopen(buf->getFullPathName(), TEXT("rb")); FILE* fp = generic_fopen(buf->getFullPathName(), TEXT("rb"));
@ -784,10 +783,11 @@ bool FileManager::reloadBuffer(BufferID id)
int64_t fileSize = _ftelli64(fp); int64_t fileSize = _ftelli64(fp);
fclose(fp); fclose(fp);
buf->_canNotify = false; //disable notify during file load, we don't want dirty status to be triggered
bool res = loadFileData(doc, fileSize, buf->getFullPathName(), data, &UnicodeConvertor, loadedFileFormat); bool res = loadFileData(doc, fileSize, buf->getFullPathName(), data, &UnicodeConvertor, loadedFileFormat);
buf->_canNotify = true;
delete[] data; delete[] data;
buf->_canNotify = true;
if (res) if (res)
{ {

View File

@ -332,7 +332,7 @@ private:
private: private:
FileManager * _pManager = nullptr; FileManager * _pManager = nullptr;
bool _canNotify = false; bool _canNotify = false; // All the notification should be disabled at the beginning
int _references = 0; // if no references file inaccessible, can be closed int _references = 0; // if no references file inaccessible, can be closed
BufferID _id = nullptr; BufferID _id = nullptr;