Revert "Allow undo after file reload and don't purge undo buffer"

This commit makes a performance issue: Re-loading the same text file over and over results in huge memory taken up
This reverts commit 198cf90c16.
Fix #5595
pull/5659/head
Don HO 6 years ago
parent 448144c228
commit f07ae664b4
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

@ -674,7 +674,7 @@ 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
bool res = loadFileData(doc, buf->getFullPathName(), data, &UnicodeConvertor, loadedFileFormat, false);
bool res = loadFileData(doc, buf->getFullPathName(), data, &UnicodeConvertor, loadedFileFormat);
buf->_canNotify = true;
if (res)
@ -1261,7 +1261,7 @@ LangType FileManager::detectLanguageFromTextBegining(const unsigned char *data,
return L_TEXT;
}
bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, Utf8_16_Read * unicodeConvertor, LoadedFileFormat& fileFormat, bool purgeUndoBuffer)
bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, Utf8_16_Read * unicodeConvertor, LoadedFileFormat& fileFormat)
{
FILE *fp = generic_fopen(filename, TEXT("rb"));
if (not fp)
@ -1295,12 +1295,6 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
{
_pscratchTilla->execute(SCI_SETREADONLY, false);
}
if (!purgeUndoBuffer)
{
_pscratchTilla->execute(SCI_BEGINUNDOACTION);
}
_pscratchTilla->execute(SCI_CLEARALL);
@ -1433,7 +1427,7 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data,
fileFormat._eolFormat = format;
}
_pscratchTilla->execute(purgeUndoBuffer ? SCI_EMPTYUNDOBUFFER : SCI_ENDUNDOACTION);
_pscratchTilla->execute(SCI_EMPTYUNDOBUFFER);
_pscratchTilla->execute(SCI_SETSAVEPOINT);
if (ro)

@ -122,7 +122,7 @@ private:
};
~FileManager();
int detectCodepage(char* buf, size_t len);
bool loadFileData(Document doc, const TCHAR* filename, char* buffer, Utf8_16_Read* UnicodeConvertor, LoadedFileFormat& fileFormat, bool purgeUndoBuffer = true);
bool loadFileData(Document doc, const TCHAR* filename, char* buffer, Utf8_16_Read* UnicodeConvertor, LoadedFileFormat& fileFormat);
LangType detectLanguageFromTextBegining(const unsigned char *data, size_t dataLen);

Loading…
Cancel
Save