summaryrefslogtreecommitdiff
path: root/Applications/HexEditor/HexEditorWidget.cpp
diff options
context:
space:
mode:
authorBrandon Scott <xeons@users.noreply.github.com>2019-10-26 16:27:26 -0500
committerAndreas Kling <awesomekling@gmail.com>2019-10-27 00:44:42 +0200
commitc77fe5161c4a5686522945ae1d360f696de838f3 (patch)
tree13e26e6c3c6c718bacacfdc12688ad29f8f326e2 /Applications/HexEditor/HexEditorWidget.cpp
parentf947353a562f89200baf1a833c395dd766d3f762 (diff)
downloadserenity-c77fe5161c4a5686522945ae1d360f696de838f3.zip
HexEditor: Added fill selection action.
Added the ability to fill the current selection with a given byte.
Diffstat (limited to 'Applications/HexEditor/HexEditorWidget.cpp')
-rw-r--r--Applications/HexEditor/HexEditorWidget.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Applications/HexEditor/HexEditorWidget.cpp b/Applications/HexEditor/HexEditorWidget.cpp
index c6d42519bb..4d8d6323c8 100644
--- a/Applications/HexEditor/HexEditorWidget.cpp
+++ b/Applications/HexEditor/HexEditorWidget.cpp
@@ -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();