From c57f952ea5cce5f59f24c6db926b2f11240f4c6f Mon Sep 17 00:00:00 2001 From: harrybharry Date: Fri, 23 Jan 2009 15:51:09 +0000 Subject: [PATCH] [BUG_FIX] Correct SCEN_SETFOCUS handling: fixes Find in files stackoverflow due to inconsistent value of pEditView. Removes the previous workaround. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@401 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 2f7c231d..19010fdc 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1574,16 +1574,6 @@ bool Notepad_plus::findInFiles() bool isInHiddenDir = _findReplaceDlg.isInHiddenDir(); int nbTotal = 0; - // For unknown reason, find in files crashes - // when focus is on main view while cloned document is side by side. - // To avoid from crash, the temporary solution is set sub view as focused window - // WALKAROUND - if (_mainEditView.getCurrentBuffer()->getDocument() == _subEditView.getCurrentBuffer()->getDocument()) - { - switchEditViewTo(SUB_VIEW); - } - // DNUORAKLAW - ScintillaEditView *pOldView = _pEditView; _pEditView = &_invisibleEditView; Document oldDoc = _invisibleEditView.execute(SCI_GETDOCPOINTER); @@ -7316,7 +7306,16 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa case WM_COMMAND: if (HIWORD(wParam) == SCEN_SETFOCUS) { - switchEditViewTo((lParam == (LPARAM)_mainEditView.getHSelf())?MAIN_VIEW:SUB_VIEW); + HWND hMain = _mainEditView.getHSelf(), hSec = _subEditView.getHSelf(); + HWND hFocus = (HWND)lParam; + if (hMain == hFocus) + switchEditViewTo(MAIN_VIEW); + else if (hSec == hFocus) + switchEditViewTo(SUB_VIEW); + else { + //Other Scintilla, ignore + } + return TRUE; } else {