From 5a3b7301c606c1ef02973f9e06db54e1b4572bfa Mon Sep 17 00:00:00 2001 From: Rodger Combs Date: Sat, 25 Nov 2017 23:27:26 -0600 Subject: [PATCH] find/replace: handle enter key in input fields --- src/dialog_search_replace.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dialog_search_replace.cpp b/src/dialog_search_replace.cpp index ddd6e0c42..7c2cb91b0 100644 --- a/src/dialog_search_replace.cpp +++ b/src/dialog_search_replace.cpp @@ -62,13 +62,13 @@ DialogSearchReplace::DialogSearchReplace(agi::Context* c, bool replace) settings->exact_match = false; auto find_sizer = new wxFlexGridSizer(2, 2, 5, 15); - find_edit = new wxComboBox(this, -1, "", wxDefaultPosition, wxSize(300, -1), recent_find, wxCB_DROPDOWN, StringBinder(&settings->find)); + find_edit = new wxComboBox(this, -1, "", wxDefaultPosition, wxSize(300, -1), recent_find, wxCB_DROPDOWN | wxTE_PROCESS_ENTER, StringBinder(&settings->find)); find_edit->SetMaxLength(0); find_sizer->Add(new wxStaticText(this, -1, _("Find what:")), wxSizerFlags().Center().Left()); find_sizer->Add(find_edit); if (has_replace) { - replace_edit = new wxComboBox(this, -1, "", wxDefaultPosition, wxSize(300, -1), lagi_MRU_wxAS("Replace"), wxCB_DROPDOWN, StringBinder(&settings->replace_with)); + replace_edit = new wxComboBox(this, -1, "", wxDefaultPosition, wxSize(300, -1), lagi_MRU_wxAS("Replace"), wxCB_DROPDOWN | wxTE_PROCESS_ENTER, StringBinder(&settings->replace_with)); replace_edit->SetMaxLength(0); find_sizer->Add(new wxStaticText(this, -1, _("Replace with:")), wxSizerFlags().Center().Left()); find_sizer->Add(replace_edit); @@ -120,6 +120,9 @@ DialogSearchReplace::DialogSearchReplace(agi::Context* c, bool replace) find_edit->SetFocus(); find_edit->SelectAll(); + find_edit->Bind(wxEVT_TEXT_ENTER, std::bind(&DialogSearchReplace::FindReplace, this, &SearchReplaceEngine::FindNext)); + if (has_replace) + replace_edit->Bind(wxEVT_TEXT_ENTER, std::bind(&DialogSearchReplace::FindReplace, this, &SearchReplaceEngine::ReplaceNext)); find_next->Bind(wxEVT_BUTTON, std::bind(&DialogSearchReplace::FindReplace, this, &SearchReplaceEngine::FindNext)); replace_next->Bind(wxEVT_BUTTON, std::bind(&DialogSearchReplace::FindReplace, this, &SearchReplaceEngine::ReplaceNext)); replace_all->Bind(wxEVT_BUTTON, std::bind(&DialogSearchReplace::FindReplace, this, &SearchReplaceEngine::ReplaceAll));