Skip to content

Commit 25ac3fa

Browse files
author
ffgriever
committed
Fix invalid set scroll position in memory editor.
If a monospace font is used for memory contents, use its size to calculate jump-to position. Previously, if monospace and variable width font sizes were different, the set scroll position would be invalid (point to offset before or after selected one).
1 parent c698b85 commit 25ac3fa

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

third_party/imgui_memory_editor/imgui_memory_editor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,11 @@ void MemoryEditor::DrawOptionsLine(const Sizes& s, void* mem_data_void, size_t m
406406
if (GotoAddr != (size_t)-1) {
407407
if (GotoAddr < mem_size) {
408408
ImGui::BeginChild("##scrolling");
409+
if (PushMonoFont) PushMonoFont();
409410
ImGui::SetScrollFromPosY(
410411
ImGui::GetCursorStartPos().y +
411412
(GotoAddr / Cols) * ImGui::GetTextLineHeight());
413+
if (PushMonoFont) ImGui::PopFont();
412414
ImGui::EndChild();
413415
DataEditingAddr = DataPreviewAddr = GotoAddr;
414416
DataEditingTakeFocus = true;

0 commit comments

Comments
 (0)