mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: Editing value not being updated correctly when moving to next hex cell
Fixes #538
This commit is contained in:
@@ -127,6 +127,7 @@ namespace hex::plugin::builtin {
|
||||
std::optional<u64> m_editingAddress;
|
||||
bool m_shouldModifyValue = false;
|
||||
bool m_enteredEditingMode = false;
|
||||
bool m_shouldUpdateEditingValue = false;
|
||||
std::vector<u8> m_editingBytes;
|
||||
|
||||
color_t m_selectionColor = 0x00;
|
||||
|
||||
@@ -463,6 +463,13 @@ namespace hex::plugin::builtin {
|
||||
void ViewHexEditor::drawCell(u64 address, u8 *data, size_t size, bool hovered) {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
|
||||
if (this->m_shouldUpdateEditingValue) {
|
||||
this->m_shouldUpdateEditingValue = false;
|
||||
|
||||
this->m_editingBytes.resize(size);
|
||||
std::memcpy(this->m_editingBytes.data(), data, size);
|
||||
}
|
||||
|
||||
if (this->m_editingAddress != address) {
|
||||
this->m_currDataVisualizer->draw(address, data, size, this->m_upperCaseHex);
|
||||
|
||||
@@ -472,9 +479,7 @@ namespace hex::plugin::builtin {
|
||||
this->m_editingAddress = address;
|
||||
this->m_shouldModifyValue = false;
|
||||
this->m_enteredEditingMode = true;
|
||||
|
||||
this->m_editingBytes.resize(size);
|
||||
std::memcpy(this->m_editingBytes.data(), data, size);
|
||||
this->m_shouldUpdateEditingValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,10 +503,8 @@ namespace hex::plugin::builtin {
|
||||
this->m_editingAddress = std::nullopt;
|
||||
}
|
||||
|
||||
this->m_editingBytes.resize(size);
|
||||
std::memcpy(this->m_editingBytes.data(), data, size);
|
||||
|
||||
this->m_shouldModifyValue = false;
|
||||
this->m_shouldUpdateEditingValue = true;
|
||||
}
|
||||
|
||||
this->m_enteredEditingMode = false;
|
||||
|
||||
Reference in New Issue
Block a user