diff --git a/platforms/desktop-shared/imgui/memory_editor.cpp b/platforms/desktop-shared/imgui/memory_editor.cpp index 1fa45ef..215d220 100644 --- a/platforms/desktop-shared/imgui/memory_editor.cpp +++ b/platforms/desktop-shared/imgui/memory_editor.cpp @@ -36,6 +36,7 @@ MemEditor::MemEditor() m_gray_out_zeros = true; m_preview_data_type = 0; m_preview_endianess = 0; + m_jump_to_address = -1; } MemEditor::~MemEditor() @@ -233,6 +234,13 @@ void MemEditor::Draw(uint8_t* mem_data, int mem_size, int base_display_addr) } } + if (m_jump_to_address >= 0 && m_jump_to_address < mem_size) + { + ImGui::SetScrollY((m_jump_to_address / m_bytes_per_row) * character_size.y); + m_selection_start = m_selection_end = m_jump_to_address; + m_jump_to_address = -1; + } + ImGui::EndTable(); } @@ -316,8 +324,7 @@ void MemEditor::HandleSelection(int address, int row) void MemEditor::JumpToAddress(int address) { - ImVec2 character_size = ImGui::CalcTextSize("0"); - ImGui::SetScrollY((address / m_bytes_per_row) * character_size.y); + m_jump_to_address = address; } void MemEditor::DrawCursors(int mem_size, int base_display_addr) diff --git a/platforms/desktop-shared/imgui/memory_editor.h b/platforms/desktop-shared/imgui/memory_editor.h index def23f9..adf4469 100644 --- a/platforms/desktop-shared/imgui/memory_editor.h +++ b/platforms/desktop-shared/imgui/memory_editor.h @@ -58,6 +58,7 @@ class MemEditor bool m_gray_out_zeros; int m_preview_data_type; int m_preview_endianess; + int m_jump_to_address; }; #endif /* MEM_EDITOR_H */ \ No newline at end of file