From 93aa1247df4bb92720f00929be5303aee1a84864 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 26 Jul 2022 15:01:21 +0200 Subject: [PATCH] fix: Switching page when jumping to selection not working --- plugins/builtin/source/content/views/view_hex_editor.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index baa800058..ed4a9997f 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -930,12 +930,11 @@ namespace hex::plugin::builtin { if (this->m_shouldJumpToSelection) { this->m_shouldJumpToSelection = false; - const auto pageAddress = provider->getCurrentPageAddress() + provider->getBaseAddress(); auto newSelection = this->getSelection(); - newSelection.address -= pageAddress; + provider->setCurrentPage(provider->getPageOfAddress(newSelection.address).value_or(0)); - provider->setCurrentPage(provider->getPageOfAddress(pageAddress).value_or(0)); - ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (static_cast(newSelection.getStartAddress()) / this->m_bytesPerRow) * CharacterSize.y, 0.5); + const auto pageAddress = provider->getCurrentPageAddress() + provider->getBaseAddress(); + ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (static_cast(newSelection.getStartAddress() - pageAddress) / this->m_bytesPerRow) * CharacterSize.y, 0.5); } } else {