From 88ea280978791ef567d0c72800d25aef30dcf5ee Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 4 Apr 2012 19:50:19 +0000 Subject: [PATCH] [BUG_FIXED] Fix find/replace bug while doc mapper is opened. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@889 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 3 +- .../WinControls/DocumentMap/documentMap.cpp | 33 +++++++++++-------- .../src/WinControls/DocumentMap/documentMap.h | 1 + 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3ee9be7c2..aba5cb6bd 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2923,7 +2923,7 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode) _pEditView->saveCurrentPos(); //allow copying of position buf->setPosition(buf->getPosition(_pEditView), _pNonEditView); _pNonEditView->restoreCurrentPos(); //set position - activateBuffer(current, otherView()); + activateBuffer(current, viewToGo); } //Open the view if it was hidden @@ -4294,6 +4294,7 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) if (_pDocMap) { _pDocMap->reloadMap(); + _pDocMap->setSyntaxLiliting(); } _linkTriggered = true; diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp index b11602552..65b616a32 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.cpp @@ -36,10 +36,6 @@ void DocumentMap::reloadMap() Buffer *editBuf = (*_ppEditView)->getCurrentBuffer(); _pScintillaEditView->setCurrentBuffer(editBuf); - // lexer - _pScintillaEditView->defineDocType(editBuf->getLangType()); - _pScintillaEditView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false); - // folding _pScintillaEditView->syncFoldStateWith((*_ppEditView)->getCurrentFoldStates()); @@ -54,6 +50,12 @@ void DocumentMap::reloadMap() } } +void DocumentMap::setSyntaxLiliting() +{ + Buffer *buf = _pScintillaEditView->getCurrentBuffer(); + _pScintillaEditView->defineDocType(buf->getLangType()); + _pScintillaEditView->showMargin(ScintillaEditView::_SC_MARGE_FOLDER, false); +} bool DocumentMap::needToRecomputeWith() { @@ -244,23 +246,26 @@ BOOL CALLBACK DocumentMap::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara { HWND hwndScintilla = (HWND)::SendMessage(_hParent, NPPM_CREATESCINTILLAHANDLE, 0, (LPARAM)_hSelf); _pScintillaEditView = (ScintillaEditView *)::SendMessage(_hParent, NPPM_INTERNAL_GETSCINTEDTVIEW, 0, (LPARAM)hwndScintilla); - ::SendMessage(_pScintillaEditView->getHSelf(), SCI_SETZOOM, (WPARAM)-10, 0); - ::SendMessage(_pScintillaEditView->getHSelf(), SCI_SETVSCROLLBAR, FALSE, 0); - ::SendMessage(_pScintillaEditView->getHSelf(), SCI_SETHSCROLLBAR, FALSE, 0); - reloadMap(); + _pScintillaEditView->execute(SCI_SETZOOM, (WPARAM)-10, 0); + _pScintillaEditView->execute(SCI_SETVSCROLLBAR, FALSE, 0); + _pScintillaEditView->execute(SCI_SETHSCROLLBAR, FALSE, 0); _pScintillaEditView->showIndentGuideLine(false); + _pScintillaEditView->display(); + + reloadMap(); + + _vzDlg.init(::GetModuleHandle(NULL), _hSelf); + _vzDlg.doDialog(); + (NppParameters::getInstance())->SetTransparent(_vzDlg.getHSelf(), 50); // 0 <= transparancy < 256 + + setSyntaxLiliting(); _pScintillaEditView->showMargin(0, false); _pScintillaEditView->showMargin(1, false); _pScintillaEditView->showMargin(2, false); _pScintillaEditView->showMargin(3, false); - - _pScintillaEditView->display(); - - _vzDlg.init(::GetModuleHandle(NULL), _hSelf); - _vzDlg.doDialog(); - (NppParameters::getInstance())->SetTransparent(_vzDlg.getHSelf(), 50); // 0 <= transparancy < 256 + return TRUE; } case WM_DESTROY: diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.h b/PowerEditor/src/WinControls/DocumentMap/documentMap.h index 4c1bd8afa..4ead06153 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.h @@ -106,6 +106,7 @@ public: void scrollMap(bool direction, moveMode whichMode); void doMove(); void fold(int line, bool foldOrNot); + void setSyntaxLiliting(); protected: virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);