diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp index e7c3b00f04..ad16ffdf15 100644 --- a/Userland/Applications/HexEditor/HexEditor.cpp +++ b/Userland/Applications/HexEditor/HexEditor.cpp @@ -229,6 +229,14 @@ void HexEditor::set_content_length(size_t length) set_content_size({ static_cast(newWidth), static_cast(newHeight) }); } +Optional HexEditor::get_byte(size_t position) +{ + if (position < m_document->size()) + return m_document->get(position).value; + + return {}; +} + void HexEditor::mousedown_event(GUI::MouseEvent& event) { if (event.button() != GUI::MouseButton::Primary) { diff --git a/Userland/Applications/HexEditor/HexEditor.h b/Userland/Applications/HexEditor/HexEditor.h index 4ec6556437..6444c4cab8 100644 --- a/Userland/Applications/HexEditor/HexEditor.h +++ b/Userland/Applications/HexEditor/HexEditor.h @@ -39,6 +39,7 @@ public: bool open_new_file(size_t size); void open_file(NonnullRefPtr file); void fill_selection(u8 fill_byte); + Optional get_byte(size_t position); bool save_as(NonnullRefPtr); bool save();