From d6bb408078f52ff01c175b8b48582671630c4359 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 30 Jan 2023 10:10:37 +0100 Subject: [PATCH] fix: All bytes being selected when opening a new provider --- plugins/builtin/source/content/views/view_hex_editor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index 606974716..6fdaa8978 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -894,9 +894,11 @@ namespace hex::plugin::builtin { auto selection = this->m_hexEditor.getSelection(); - oldData.selectionStart = selection.getStartAddress(); - oldData.selectionEnd = selection.getEndAddress(); - oldData.scrollPosition = this->m_hexEditor.getScrollPosition(); + if (selection != Region::Invalid()) { + oldData.selectionStart = selection.getStartAddress(); + oldData.selectionEnd = selection.getEndAddress(); + oldData.scrollPosition = this->m_hexEditor.getScrollPosition(); + } } if (newProvider != nullptr) {