From ee41a5a0467e3f7dbb8e0865b63df3596c672913 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 21 Jul 2023 14:22:53 +0200 Subject: [PATCH] fix: Selection changes not being handled correctly --- plugins/builtin/include/ui/hex_editor.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/builtin/include/ui/hex_editor.hpp b/plugins/builtin/include/ui/hex_editor.hpp index 42ce8f07e..f7ed0ee39 100644 --- a/plugins/builtin/include/ui/hex_editor.hpp +++ b/plugins/builtin/include/ui/hex_editor.hpp @@ -58,6 +58,8 @@ namespace hex::plugin::builtin::ui { return value & ~(alignment - 1); }; + this->m_selectionChanged = this->m_selectionStart != start || this->m_selectionEnd != end; + if (!this->m_selectionStart.has_value()) this->m_selectionStart = start; if (!this->m_selectionEnd.has_value()) this->m_selectionEnd = end; @@ -75,7 +77,6 @@ namespace hex::plugin::builtin::ui { this->m_selectionEnd = std::clamp(end, 0, maxAddress); this->m_cursorPosition = this->m_selectionEnd; - this->m_selectionChanged = this->m_selectionStart != start || this->m_selectionEnd != end; if (this->m_selectionChanged) { auto selection = this->getSelection(); EventManager::post(ImHexApi::HexEditor::ProviderRegion{ { selection.address, selection.size }, this->m_provider });