From 3b5efb37e9ea3668d1ee01c20f6514ffd40fa681 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 17 Dec 2023 23:31:01 +0100 Subject: [PATCH] fix: Editing data inspector rows not working correctly --- .../builtin/source/content/views/view_data_inspector.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/source/content/views/view_data_inspector.cpp b/plugins/builtin/source/content/views/view_data_inspector.cpp index df0b3e055..f439619ae 100644 --- a/plugins/builtin/source/content/views/view_data_inspector.cpp +++ b/plugins/builtin/source/content/views/view_data_inspector.cpp @@ -13,6 +13,8 @@ #include #include +#include + namespace hex::plugin::builtin { using NumberDisplayStyle = ContentRegistry::DataInspector::NumberDisplayStyle; @@ -275,12 +277,15 @@ namespace hex::plugin::builtin { // Turn the entered value into bytes auto bytes = editingFunction.value()(this->m_editingValue, this->m_endian); + if (this->m_invert) + std::ranges::transform(bytes, bytes.begin(), [](auto byte) { return byte ^ 0xFF; }); + // Write those bytes to the selected provider at the current address this->m_selectedProvider->write(this->m_startAddress, bytes.data(), bytes.size()); // Disable editing mode this->m_editingValue.clear(); - editing = false; + editing = false; // Reload all inspector rows this->m_shouldInvalidate = true; @@ -288,7 +293,7 @@ namespace hex::plugin::builtin { ImGui::PopStyleVar(); // Disable editing mode when clicking outside the input text box - if (!ImGui::IsItemHovered() && ImGui::IsAnyMouseDown()) { + if (!ImGui::IsItemHovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Left)) { this->m_editingValue.clear(); editing = false; }