|
|
|
@ -877,6 +877,12 @@ void Window::set_menu_actions() { |
|
|
|
menu.add_action("source_find_pattern", [this]() { |
|
|
|
menu.add_action("source_find_pattern", [this]() { |
|
|
|
EntryBox::get().clear(); |
|
|
|
EntryBox::get().clear(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(focused_view && Config::get().source.search_for_selection) { |
|
|
|
|
|
|
|
Gtk::TextIter start, end; |
|
|
|
|
|
|
|
if(focused_view->get_buffer()->get_selection_bounds(start, end)) |
|
|
|
|
|
|
|
last_find_pattern = focused_view->get_buffer()->get_text(start, end); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
EntryBox::get().entries.emplace_back(last_find_pattern, [this](const std::string &pattern_) { |
|
|
|
EntryBox::get().entries.emplace_back(last_find_pattern, [this](const std::string &pattern_) { |
|
|
|
auto pattern = pattern_; // Store pattern to safely hide entrybox
|
|
|
|
auto pattern = pattern_; // Store pattern to safely hide entrybox
|
|
|
|
EntryBox::get().hide(); |
|
|
|
EntryBox::get().hide(); |
|
|
|
@ -2090,13 +2096,11 @@ void Window::search_and_replace_entry() { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if(focused_view) { |
|
|
|
if(focused_view && Config::get().source.search_for_selection) { |
|
|
|
if(Config::get().source.search_for_selection) { |
|
|
|
|
|
|
|
Gtk::TextIter start, end; |
|
|
|
Gtk::TextIter start, end; |
|
|
|
if(focused_view->get_buffer()->get_selection_bounds(start, end)) |
|
|
|
if(focused_view->get_buffer()->get_selection_bounds(start, end)) |
|
|
|
last_search = focused_view->get_buffer()->get_text(start, end); |
|
|
|
last_search = focused_view->get_buffer()->get_text(start, end); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
EntryBox::get().entries.emplace_back(last_search, [this](const std::string &content) { |
|
|
|
EntryBox::get().entries.emplace_back(last_search, [this](const std::string &content) { |
|
|
|
if(focused_view) |
|
|
|
if(focused_view) |
|
|
|
focused_view->search_forward(); |
|
|
|
focused_view->search_forward(); |
|
|
|
|