From 2321e648ae467cbecf8388f143ad71a86a05a472 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Fri, 18 Feb 2022 14:49:21 +0100 Subject: [PATCH] Fix regression: file can't be saved if it's set to other charset before Fix #11238 --- PowerEditor/src/ScintillaComponent/Buffer.cpp | 4 ++-- PowerEditor/src/ScintillaComponent/Buffer.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index 282d2b302..96914556a 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -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. // 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 FILE* fp = generic_fopen(buf->getFullPathName(), TEXT("rb")); @@ -784,10 +783,11 @@ bool FileManager::reloadBuffer(BufferID id) int64_t fileSize = _ftelli64(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); + buf->_canNotify = true; delete[] data; - buf->_canNotify = true; if (res) { diff --git a/PowerEditor/src/ScintillaComponent/Buffer.h b/PowerEditor/src/ScintillaComponent/Buffer.h index 1c65e4a6d..5dab54ef5 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.h +++ b/PowerEditor/src/ScintillaComponent/Buffer.h @@ -332,7 +332,7 @@ private: private: 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 BufferID _id = nullptr;