From ec2934b4b8cd88a3b876f1ff85d79f1fe2f3a952 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 14 Mar 2023 10:24:25 +0100 Subject: [PATCH] fix: Advancing to next row when editing bytes loading wrong value Fixes #973 --- plugins/builtin/source/ui/hex_editor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/builtin/source/ui/hex_editor.cpp b/plugins/builtin/source/ui/hex_editor.cpp index 00d7d09d3..194a7dd1c 100644 --- a/plugins/builtin/source/ui/hex_editor.cpp +++ b/plugins/builtin/source/ui/hex_editor.cpp @@ -262,11 +262,13 @@ namespace hex::plugin::builtin::ui { void HexEditor::drawCell(u64 address, u8 *data, size_t size, bool hovered, CellType cellType) { static DataVisualizerAscii asciiVisualizer; - if (this->m_shouldUpdateEditingValue) { - this->m_shouldUpdateEditingValue = false; + if (this->m_shouldUpdateEditingValue && this->m_editingAddress.has_value()) { + if (!((this->m_editingAddress.value() % this->m_bytesPerRow) == 0 && address != this->m_editingAddress.value())) { + this->m_shouldUpdateEditingValue = false; - this->m_editingBytes.resize(size); - std::memcpy(this->m_editingBytes.data(), data, size); + this->m_editingBytes.resize(size); + std::memcpy(this->m_editingBytes.data(), data, size); + } } if (this->m_editingAddress != address || this->m_editingCellType != cellType) {