1
0
mirror of synced 2024-11-14 19:17:42 +01:00

fix: Switching page when jumping to selection not working

This commit is contained in:
WerWolv 2022-07-26 15:01:21 +02:00
parent fb4c21b97a
commit 93aa1247df

View File

@ -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<long double>(newSelection.getStartAddress()) / this->m_bytesPerRow) * CharacterSize.y, 0.5);
const auto pageAddress = provider->getCurrentPageAddress() + provider->getBaseAddress();
ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (static_cast<long double>(newSelection.getStartAddress() - pageAddress) / this->m_bytesPerRow) * CharacterSize.y, 0.5);
}
} else {