From 0affe35bc61e162f31f5f0bccd7e2e86d1eea698 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Wed, 2 Mar 2022 12:11:20 +0100 Subject: [PATCH] Re-enable possibility to center the FindReplaceDlg on Notepad++ main window * add goToCenter to hotkey check in IDM_SEARCH_(FIND|REPLACE|FINDINFILES|MARK) Before commit aa69711d it was possible to center the dialog on Notepad++ using a second CTRL+F but was lost during the implementation of #10019, #10177. This will re-add the function: * When the hotkey used is not associated with the current tab, it will switch to the new tab (as before). * If the hotkey used is associated with the current tab, it will center the FindReplaceDlg on Notepad++. Fix #9201, close #11323 --- .../src/ScintillaComponent/FindReplaceDlg.cpp | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index cc81ff5c9..a30cc7108 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -1287,22 +1287,34 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA return TRUE; case IDM_SEARCH_FIND: - enableReplaceFunc(false); // enable relace false so only find + if (_currentStatus == FIND_DLG) + goToCenter(); + else + enableReplaceFunc(false); return TRUE; case IDM_SEARCH_REPLACE: - enableReplaceFunc(true); + if (_currentStatus == REPLACE_DLG) + goToCenter(); + else + enableReplaceFunc(true); return TRUE; case IDM_SEARCH_FINDINFILES: - enableFindInFilesFunc(); + if (_currentStatus == FINDINFILES_DLG) + goToCenter(); + else + enableFindInFilesFunc(); return TRUE; case IDM_SEARCH_MARK: - enableMarkFunc(); + if (_currentStatus == MARK_DLG) + goToCenter(); + else + enableMarkFunc(); return TRUE; - case IDREPLACE : + case IDREPLACE: { std::lock_guard lock(findOps_mutex);