Fix bug with lexer.

Saving doesnt reset language if name not changed.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@240 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
harrybharry 2008-06-16 19:54:03 +00:00
parent 5998725315
commit fe67fabc7c
3 changed files with 13 additions and 4 deletions

View File

@ -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);

View File

@ -134,6 +134,8 @@ public :
_unicodeMode = ndds._encoding;
_userLangExt[0] = 0;
_fullPathName[0] = 0;
_fileName = NULL;
setFileName(fileName, ndds._lang);
updateTimeStamp();
checkFileState();

View File

@ -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());
}