From 780e7432228417df9b41fd8f8fd6a433a1f15293 Mon Sep 17 00:00:00 2001 From: milleniumbug Date: Thu, 31 Mar 2016 00:29:05 +0200 Subject: [PATCH] added gui buttons for finding/replacing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit using [↑][⇄][↓] for "Find Previous", "Replace current", "Find Next" see issue #170 --- src/window.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/window.cc b/src/window.cc index 2adcea4..7d89495 100644 --- a/src/window.cc +++ b/src/window.cc @@ -876,7 +876,22 @@ void Window::search_and_replace_entry() { replace_entry_it->signal_changed().connect([this, replace_entry_it](){ last_replace=replace_entry_it->get_text(); }); - + EntryBox::get().buttons.emplace_back("↑", [this](){ + if(notebook.get_current_page()!=-1) + notebook.get_current_view()->search_backward(); + }); + EntryBox::get().buttons.back().set_tooltip_text("Find previous\n\nShortcut: press Shift+Enter in the search field"); + EntryBox::get().buttons.emplace_back("⇄", [this, replace_entry_it](){ + if(notebook.get_current_page()!=-1) { + notebook.get_current_view()->replace_forward(replace_entry_it->get_text()); + } + }); + EntryBox::get().buttons.back().set_tooltip_text("Replace current selection\n\nShortcut: press Enter in the replacement field"); + EntryBox::get().buttons.emplace_back("↓", [this](){ + if(notebook.get_current_page()!=-1) + notebook.get_current_view()->search_forward(); + }); + EntryBox::get().buttons.back().set_tooltip_text("Find next\n\nShortcut: press Enter in the search field"); EntryBox::get().buttons.emplace_back("Replace all", [this, replace_entry_it](){ if(notebook.get_current_page()!=-1) notebook.get_current_view()->replace_all(replace_entry_it->get_text());