feat: Allow hex editor editing mode to be entered when pressing Enter
This commit is contained in:
parent
709f4b7e80
commit
893b06c78b
@ -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;
|
||||
|
||||
|
@ -708,6 +708,11 @@ namespace hex::plugin::builtin {
|
||||
EventManager::post<EventRegionSelected>(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();
|
||||
|
Loading…
Reference in New Issue
Block a user