1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

HexEditor: Add find_all_strings() function

This commit is contained in:
Brendan Coles 2021-05-29 08:49:35 +00:00 committed by Ali Mohammad Pur
parent 10ceeb092f
commit 90e9d1a0a1
3 changed files with 50 additions and 0 deletions

View file

@ -257,6 +257,21 @@ void HexEditorWidget::initialize_menubar(GUI::Menubar& menubar)
m_editor->update();
m_last_found_index = result;
}));
edit_menu.add_action(GUI::Action::create("Find All &Strings", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/find.png"), [&](const GUI::Action&) {
int min_length = 4;
auto matches = m_editor->find_all_strings(min_length);
m_search_results->set_model(*new SearchResultsModel(move(matches)));
m_search_results->update();
if (matches.is_empty()) {
GUI::MessageBox::show(window(), "No strings found in this file", "Not found", GUI::MessageBox::Type::Warning);
return;
}
set_search_results_visible(true);
m_editor->update();
}));
edit_menu.add_separator();
edit_menu.add_action(*m_goto_offset_action);