diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 86e64fff8..4aa668618 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3775,6 +3775,28 @@ void Notepad_plus::command(int id) } break; + case IDM_SEARCH_SETANDFINDNEXT : + case IDM_SEARCH_SETANDFINDPREV : + { + bool isFirstTime = !_findReplaceDlg.isCreated(); + if (isFirstTime) + _findReplaceDlg.doDialog(FIND_DLG, _isRTL, false); + + const int strSize = FINDREPLACE_MAXLENGTH; + TCHAR str[strSize]; + _pEditView->getGenericSelectedText(str, strSize); + _findReplaceDlg.setSearchText(str); + setFindReplaceFolderFilter(NULL, NULL); + if (isFirstTime) + changeFindReplaceDlgLang(); + + FindOption op = _findReplaceDlg.getCurrentOptions(); + op._whichDirection = (id == IDM_SEARCH_SETANDFINDNEXT?DIR_DOWN:DIR_UP); + + _findReplaceDlg.processFindNext(str, &op); + break; + } + case IDM_SEARCH_GOTONEXTFOUND: { _findReplaceDlg.gotoNextFoundResult(); @@ -5377,6 +5399,8 @@ void Notepad_plus::command(int id) case IDM_EDIT_DELETE: case IDM_SEARCH_FINDNEXT : case IDM_SEARCH_FINDPREV : + case IDM_SEARCH_SETANDFINDNEXT : + case IDM_SEARCH_SETANDFINDPREV : case IDM_SEARCH_GOTOMATCHINGBRACE : case IDM_SEARCH_TOGGLE_BOOKMARK : case IDM_SEARCH_NEXT_BOOKMARK: diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index fc51fac27..2d96c3d41 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -267,6 +267,8 @@ BEGIN MENUITEM "Find in Files...", IDM_SEARCH_FINDINFILES MENUITEM "Find &Next", IDM_SEARCH_FINDNEXT MENUITEM "Find &Previous", IDM_SEARCH_FINDPREV + MENUITEM "Select and Find Next", IDM_SEARCH_SETANDFINDNEXT + MENUITEM "Select and Find Previous", IDM_SEARCH_SETANDFINDPREV MENUITEM "Find (Volatile) Next", IDM_SEARCH_VOLATILE_FINDNEXT MENUITEM "Find (Volatile) Previous", IDM_SEARCH_VOLATILE_FINDPREV MENUITEM "&Replace...", IDM_SEARCH_REPLACE diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 9c8975de4..5ac08f82e 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -103,8 +103,10 @@ WinMenuKeyDefinition winKeyDefs[] = { {VK_F, IDM_SEARCH_FINDINFILES, true, false, true, NULL}, {VK_F3, IDM_SEARCH_FINDNEXT, false, false, false, NULL}, {VK_F3, IDM_SEARCH_FINDPREV, false, false, true, NULL}, - {VK_F3, IDM_SEARCH_VOLATILE_FINDNEXT, true, false, false, NULL}, - {VK_F3, IDM_SEARCH_VOLATILE_FINDPREV, true, false, true, NULL}, + {VK_F3, IDM_SEARCH_VOLATILE_FINDNEXT, true, true, false, NULL}, + {VK_F3, IDM_SEARCH_VOLATILE_FINDPREV, true, true, true, NULL}, + {VK_F3, IDM_SEARCH_SETANDFINDNEXT, true, false, false, NULL}, + {VK_F3, IDM_SEARCH_SETANDFINDPREV, true, false, true, NULL}, {VK_F4, IDM_SEARCH_GOTONEXTFOUND, false, false, false, NULL}, {VK_F4, IDM_SEARCH_GOTOPREVFOUND, false, false, true, NULL}, {VK_F7, IDM_FOCUS_ON_FOUND_RESULTS, false, false, false, NULL}, diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 22caedd89..bd2052e35 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -1828,7 +1828,7 @@ void FindReplaceDlg::initOptionsFromDlg() ::EnableWindow(::GetDlgItem(_hSelf, IDCMARKALL), (_doMarkLine || _doStyleFoundToken)); } -void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL) +void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL, bool toShow) { if (!isCreated()) { @@ -1842,7 +1842,8 @@ void FindReplaceDlg::doDialog(DIALOG_TYPE whichType, bool isRTL) enableReplaceFunc(whichType == REPLACE_DLG); ::SetFocus(::GetDlgItem(_hSelf, IDFINDWHAT)); - display(); + //display(); + display(toShow); } LRESULT FAR PASCAL FindReplaceDlg::finderProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h index 2bcf6452c..d0eff9579 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h @@ -175,7 +175,7 @@ public : void initOptionsFromDlg(); - void doDialog(DIALOG_TYPE whichType, bool isRTL = false); + void doDialog(DIALOG_TYPE whichType, bool isRTL = false, bool toShow = true); bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL, FindStatus *oFindStatus = NULL); bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = NULL); diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 80974003a..499844afd 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -150,6 +150,9 @@ #define IDM_FOCUS_ON_FOUND_RESULTS (IDM_SEARCH + 45) #define IDM_SEARCH_GOTONEXTFOUND (IDM_SEARCH + 46) #define IDM_SEARCH_GOTOPREVFOUND (IDM_SEARCH + 47) + + #define IDM_SEARCH_SETANDFINDNEXT (IDM_SEARCH + 48) + #define IDM_SEARCH_SETANDFINDPREV (IDM_SEARCH + 49) #define IDM_VIEW (IDM + 4000)