From c677aae7b12f5775401d1293c2502f0353241511 Mon Sep 17 00:00:00 2001 From: paxcut Date: Fri, 20 Mar 2026 04:40:08 -0700 Subject: [PATCH] fixed choppy text rendering when dragging the scrollbar with mouse (credit goes to WerWolv) and top margin adjustment when find/replace popup window first appears if it is blocking the entry under the cursor. --- plugins/ui/source/ui/text_editor/render.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/ui/source/ui/text_editor/render.cpp b/plugins/ui/source/ui/text_editor/render.cpp index fa9d2f868..06ddeba32 100644 --- a/plugins/ui/source/ui/text_editor/render.cpp +++ b/plugins/ui/source/ui/text_editor/render.cpp @@ -1146,10 +1146,6 @@ namespace hex::ui { m_scroll = ImVec2(scrollX, scrollY); } - if (m_lines.m_setTopRow) - m_lines.setFirstRow(); - else - m_lines.m_topRow = std::max(0.0F, (scrollY - m_lines.m_topMargin) / m_lines.m_charAdvance.y); m_topLineNumber = getTopLineNumber(); float maxDisplayedRow = m_lines.getMaxDisplayedRow(); float lineIndex = m_topLineNumber; @@ -1207,6 +1203,10 @@ namespace hex::ui { row = row + 1.0F; } + if (m_lines.m_setTopRow) + m_lines.setFirstRow(); + else + m_lines.m_topRow = std::max(0.0F, (scrollY - m_lines.m_topMargin) / m_lines.m_charAdvance.y); } else { m_lines.m_rowToLineIndex[0] = 1; m_topLineNumber = 1; @@ -1662,6 +1662,8 @@ namespace hex::ui { m_shiftedScrollY = oldScrollY - pixelCount; ImGui::SetScrollY(m_shiftedScrollY); m_lines.m_topMargin = m_newTopMargin; + + m_lines.ensureCursorVisible(); } } }