Fix regression: file can't be saved if it's set to other charset before
Fix #11238
This commit is contained in:
parent
4555db8f91
commit
2321e648ae
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue