diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 19623328c..373a7728a 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4399,7 +4399,7 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode) } } -bool Notepad_plus::activateBuffer(BufferID id, int whichOne) +bool Notepad_plus::activateBuffer(BufferID id, int whichOne, bool forceApplyHilite) { NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); bool isSnapshotMode = nppGui.isSnapshotMode(); @@ -4420,7 +4420,7 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne) if (_mainDocTab.activateBuffer(id)) //only activate if possible { _isFolding = true; - _mainEditView.activateBuffer(id); + _mainEditView.activateBuffer(id, forceApplyHilite); _isFolding = false; } else @@ -4431,7 +4431,7 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne) if (_subDocTab.activateBuffer(id)) { _isFolding = true; - _subEditView.activateBuffer(id); + _subEditView.activateBuffer(id, forceApplyHilite); _isFolding = false; } else diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index aec694daf..966fa83cb 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -451,7 +451,7 @@ private: void loadBufferIntoView(BufferID id, int whichOne, bool dontClose = false); //Doesnt _activate_ the buffer bool removeBufferFromView(BufferID id, int whichOne); //Activates alternative of possible, or creates clean document if not clean already - bool activateBuffer(BufferID id, int whichOne); //activate buffer in that view if found + bool activateBuffer(BufferID id, int whichOne, bool forceApplyHilite = false); //activate buffer in that view if found void notifyBufferActivated(BufferID bufid, int view); void performPostReload(int whichOne); //END: Document management diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 867461456..85472c871 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -522,7 +522,7 @@ bool Notepad_plus::doReload(BufferID id, bool alert) // Once reload is complete, activate buffer which will take care of // many settings such as update status bar, clickable link etc. - activateBuffer(id, currentView()); + activateBuffer(id, currentView(), true); return res; } diff --git a/PowerEditor/src/ScintillaComponent/Buffer.h b/PowerEditor/src/ScintillaComponent/Buffer.h index 40c33f734..919bda713 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.h +++ b/PowerEditor/src/ScintillaComponent/Buffer.h @@ -64,7 +64,6 @@ class FileManager final { public: void init(Notepad_plus* pNotepadPlus, ScintillaEditView* pscratchTilla); - //void activateBuffer(int index); void checkFilesystemChanges(bool bCheckOnlyCurrentBuffer); size_t getNbBuffers() const { return _nbBufs; }; diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index 5f57cd0e7..3a464cfa8 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -1903,11 +1903,11 @@ bool ScintillaEditView::setLexerFromLangID(int langID) // Internal lexer only } -void ScintillaEditView::activateBuffer(BufferID buffer) +void ScintillaEditView::activateBuffer(BufferID buffer, bool force) { if (buffer == BUFFER_INVALID) return; - if (buffer == _currentBuffer) + if (!force && buffer == _currentBuffer) return; Buffer * newBuf = MainFileManager.getBufferByID(buffer); diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 05112c4bf..935d6e2c8 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -222,7 +222,7 @@ public: } }; - void activateBuffer(BufferID buffer); + void activateBuffer(BufferID buffer, bool force = false); void getCurrentFoldStates(std::vector & lineStateVector); void syncFoldStateWith(const std::vector & lineStateVectorNew);