From ba6a9c260b2ffa0c9a0ff331cf7542b1508959ac Mon Sep 17 00:00:00 2001 From: harrybharry Date: Mon, 16 Jun 2008 13:16:36 +0000 Subject: [PATCH] Fix correct userdefined lang not selected when opening file. Fix view not updating if userdefine is changed (only for active view) git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@238 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 1 + PowerEditor/src/ScitillaComponent/Buffer.cpp | 2 +- PowerEditor/src/ScitillaComponent/Buffer.h | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 2e96e2c6..6b584795 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4443,6 +4443,7 @@ int Notepad_plus::switchEditViewTo(int gid) _pEditView = _pNonEditView; _pNonEditView = tempView; + _pEditView->beSwitched(); _pEditView->getFocus(); //set the focus notifyBufferActivated(_pEditView->getCurrentBufferID(), currentView()); diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 5c772376..7586c8e8 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -128,7 +128,7 @@ void Buffer::setFileName(const char *fn, LangType defaultLang) } updateTimeStamp(); - if (newLang != _lang) { + if (newLang != _lang || _lang == L_USER) { _lang = newLang; doNotify(BufferChangeFilename | BufferChangeLanguage | BufferChangeTimestamp); return; diff --git a/PowerEditor/src/ScitillaComponent/Buffer.h b/PowerEditor/src/ScitillaComponent/Buffer.h index 89ac2402..68fb0c9c 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.h +++ b/PowerEditor/src/ScitillaComponent/Buffer.h @@ -133,12 +133,13 @@ public : _format = ndds._format; _unicodeMode = ndds._encoding; + _userLangExt[0] = 0; setFileName(fileName, ndds._lang); updateTimeStamp(); checkFileState(); _currentStatus = type; _isDirty = false; - _userLangExt[0] = 0; + if (type == DOC_UNNAMED) _needLexer = false; //empty document, no styling _canNotify = true; @@ -223,7 +224,7 @@ public : strcpy(_userLangExt, userLangName); } _needLexer = true; //change of lang means lexern eeds updating - doNotify(BufferChangeLanguage); + doNotify(BufferChangeLanguage|BufferChangeLexing); }; UniMode getUnicodeMode() const {