diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index f4792f317..9df216d9f 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -1501,8 +1501,9 @@ int FileManager::getFileNameFromBuffer(BufferID id, TCHAR * fn2copy) int FileManager::docLength(Buffer* buffer) const { + Document curDoc = _pscratchTilla->execute(SCI_GETDOCPOINTER); _pscratchTilla->execute(SCI_SETDOCPOINTER, 0, buffer->_doc); int docLen = _pscratchTilla->getCurrentDocLen(); - _pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault); + _pscratchTilla->execute(SCI_SETDOCPOINTER, 0, curDoc); return docLen; }