From 9deb93204d351c0f7b5f856dff3691e7cfcd92b0 Mon Sep 17 00:00:00 2001 From: yniq Date: Thu, 23 Apr 2009 12:35:46 +0000 Subject: [PATCH] [UPDATE] "Switch to found results window" command now switches back to the current edit view if the focus is already on the found results. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@453 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 11 +++++++---- PowerEditor/src/ScitillaComponent/FindReplaceDlg.h | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 96d543645..2c4f28959 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3238,7 +3238,7 @@ void Notepad_plus::command(int id) _findReplaceDlg.doDialog((id == IDM_SEARCH_FIND)?FIND_DLG:REPLACE_DLG, _isRTL); _pEditView->getGenericSelectedText(str, strSize); - _findReplaceDlg.setSearchText(str, _pEditView->getCurrentBuffer()->getUnicodeMode() != uni8Bit); + _findReplaceDlg.setSearchText(str); setFindReplaceFolderFilter(NULL, NULL); if (isFirstTime) @@ -3290,7 +3290,11 @@ void Notepad_plus::command(int id) } case NPPM_INTERNAL_FOCUS_ON_FOUND_RESULTS: { - _findReplaceDlg.focusOnFinder(); + if (GetFocus() == _findReplaceDlg.getHFindResults()) + // focus already on found results, switch to current edit view + switchEditViewTo(currentView()); + else + _findReplaceDlg.focusOnFinder(); break; } case IDM_SEARCH_VOLATILE_FINDNEXT : @@ -7395,7 +7399,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa _findReplaceDlg.doDialog(FIND_DLG, _isRTL); _pEditView->getGenericSelectedText(str, strSize); - _findReplaceDlg.setSearchText(str, _pEditView->getCurrentBuffer()->getUnicodeMode() != uni8Bit); + _findReplaceDlg.setSearchText(str); if (isFirstTime) changeDlgLang(_findReplaceDlg.getHSelf(), "Find"); _findReplaceDlg.launchFindInFilesDlg(); @@ -9390,7 +9394,6 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, c Session currentSession; if ((nbFile) && (!fileNames)) { - for (size_t i = 0 ; i < nbFile ; i++) { if (PathFileExists(fileNames[i])) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 36b377e4f..bb34c13ae 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -323,7 +323,7 @@ public : void replaceAllInOpenedDocs(); void findAllIn(InWhat op); - void setSearchText(TCHAR * txt2find, bool isUTF8 = false) { + void setSearchText(TCHAR * txt2find) { HWND hCombo = ::GetDlgItem(_hSelf, IDFINDWHAT); if (txt2find && txt2find[0]) { @@ -396,6 +396,12 @@ public : } }; + HWND getHFindResults() { + if (_pFinder) + return _pFinder->_scintView.getHSelf(); + return NULL; + } + void updateFinderScintilla() { if (_pFinder && _pFinder->isCreated() && _pFinder->isVisible()) {