diff --git a/plugins/builtin/include/ui/hex_editor.hpp b/plugins/builtin/include/ui/hex_editor.hpp index 559e74f64..b6e467fe5 100644 --- a/plugins/builtin/include/ui/hex_editor.hpp +++ b/plugins/builtin/include/ui/hex_editor.hpp @@ -183,6 +183,20 @@ namespace hex::plugin::builtin::ui { this->m_scrollPosition = scrollPosition; } + void setEditingAddress(u64 address) { + this->m_editingAddress = address; + this->m_shouldModifyValue = false; + this->m_enteredEditingMode = true; + + this->m_editingBytes.resize(this->m_currDataVisualizer->getBytesPerCell()); + this->m_provider->read(address + this->m_provider->getBaseAddress(), this->m_editingBytes.data(), this->m_editingBytes.size()); + this->m_editingCellType = CellType::Hex; + } + + void clearEditingAddress() { + this->m_editingAddress = std::nullopt; + } + private: prv::Provider *m_provider; diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index f8c8630a6..45d6c00f7 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -708,6 +708,11 @@ namespace hex::plugin::builtin { EventManager::post(ImHexApi::HexEditor::ProviderRegion{ this->getSelection(), provider }); }); + ShortcutManager::addShortcut(this, Keys::Enter, [this] { + if (auto cursor = this->m_hexEditor.getCursorPosition(); cursor.has_value()) + this->m_hexEditor.setEditingAddress(cursor.value()); + }); + // Move cursor around ShortcutManager::addShortcut(this, Keys::Up, [this] { auto selection = getSelection();