From 88756c83c798fad10850c6acc5d8f64c50080850 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 14 Mar 2024 17:49:46 +0100 Subject: [PATCH] fix: Right clicking reverse selected regions deselecting it --- plugins/ui/source/ui/hex_editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ui/source/ui/hex_editor.cpp b/plugins/ui/source/ui/hex_editor.cpp index d6d647def..77a6cf8c8 100644 --- a/plugins/ui/source/ui/hex_editor.cpp +++ b/plugins/ui/source/ui/hex_editor.cpp @@ -1056,7 +1056,7 @@ namespace hex::ui { this->setSelection(selectionStart.value_or(address), endAddress); this->scrollToSelection(); } - else if (ImGui::IsMouseDown(ImGuiMouseButton_Left) || (ImGui::IsMouseDown(ImGuiMouseButton_Right) && (address < m_selectionStart || address > m_selectionEnd))) { + else if (ImGui::IsMouseDown(ImGuiMouseButton_Left) || (ImGui::IsMouseDown(ImGuiMouseButton_Right) && (address < std::min(m_selectionStart, m_selectionEnd) || address > std::max(m_selectionStart, m_selectionEnd)))) { if (ImGui::GetIO().KeyShift) this->setSelection(selectionStart.value_or(address), endAddress); else