1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:08:10 +00:00

HexEditor: Added fill selection action.

Added the ability to fill the current selection with a given byte.
This commit is contained in:
Brandon Scott 2019-10-26 16:27:26 -05:00 committed by Andreas Kling
parent f947353a56
commit c77fe5161c
3 changed files with 23 additions and 0 deletions

View file

@ -147,6 +147,14 @@ HexEditorWidget::HexEditorWidget()
});
auto edit_menu = make<GMenu>("Edit");
edit_menu->add_action(GAction::create("Fill selection...", [&](const GAction&) {
auto input_box = GInputBox::construct("Fill byte (hex):", "Fill Selection", this);
if (input_box->exec() == GInputBox::ExecOK && !input_box->text_value().is_empty()) {
auto fill_byte = strtol(input_box->text_value().characters(), nullptr, 16);
m_editor->fill_selection(fill_byte);
}
}));
edit_menu->add_separator();
edit_menu->add_action(*m_goto_decimal_offset_action);
edit_menu->add_action(*m_goto_hex_offset_action);
edit_menu->add_separator();