diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 7586c8e8..67d6cf53 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -96,6 +96,11 @@ void Buffer::updateTimeStamp() { void Buffer::setFileName(const char *fn, LangType defaultLang) { NppParameters *pNppParamInst = NppParameters::getInstance(); + if (!strcmpi(fn, _fullPathName)) { + updateTimeStamp(); + doNotify(BufferChangeTimestamp); + return; + } strcpy(_fullPathName, fn); _fileName = PathFindFileName(_fullPathName); diff --git a/PowerEditor/src/ScitillaComponent/Buffer.h b/PowerEditor/src/ScitillaComponent/Buffer.h index 68fb0c9c..e812f689 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.h +++ b/PowerEditor/src/ScitillaComponent/Buffer.h @@ -134,6 +134,8 @@ public : _unicodeMode = ndds._encoding; _userLangExt[0] = 0; + _fullPathName[0] = 0; + _fileName = NULL; setFileName(fileName, ndds._lang); updateTimeStamp(); checkFileState(); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 8148c88b..7907d998 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -1087,15 +1087,17 @@ void ScintillaEditView::activateBuffer(BufferID buffer) void ScintillaEditView::bufferUpdated(Buffer * buffer, int mask) { //actually only care about language and lexing etc if (buffer == _currentBuffer) { + if (mask & BufferChangeLanguage) { + defineDocType(buffer->getLangType()); + foldAll(fold_uncollapse); + } + if (mask & BufferChangeLexing) { if (buffer->getNeedsLexing()) { restyleBuffer(); //sets to false, this will apply to any other view aswell } //else nothing, otherwise infinite loop } - if (mask & BufferChangeLanguage) { - defineDocType(buffer->getLangType()); - foldAll(fold_uncollapse); - } + if (mask & BufferChangeFormat) { execute(SCI_SETEOLMODE, _currentBuffer->getFormat()); }