From 71f151397a9ede6604e140df9e2badbc11e30b34 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 29 Feb 2024 01:32:45 +0100 Subject: [PATCH] ImGui: initialize newly added member vars and fix scrolling regression The types should be floats instead of ints, the compiler actually compiled it as ints after changing to ImCeil. Made vars of correct type and removed extraneous casts. --- r5dev/thirdparty/imgui/misc/imgui_logger.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/r5dev/thirdparty/imgui/misc/imgui_logger.cpp b/r5dev/thirdparty/imgui/misc/imgui_logger.cpp index 6be9b025..bd0ddaf1 100644 --- a/r5dev/thirdparty/imgui/misc/imgui_logger.cpp +++ b/r5dev/thirdparty/imgui/misc/imgui_logger.cpp @@ -23,6 +23,8 @@ static bool equals(InputIt1 first1, InputIt1 last1, CTextLogger::CTextLogger() : m_bAutoScroll(true) , m_bScrollToCursor(false) + , m_bScrollToStart(false) + , m_bScrolledToStart(false) , m_bScrollToBottom(true) , m_bScrolledToBottom(false) , m_bHandleUserInputs(true) @@ -1533,11 +1535,11 @@ void CTextLogger::EnsureCursorVisible() float width = ImGui::GetWindowWidth(); float height = ImGui::GetWindowHeight(); - int top = 1 + static_cast(ImCeil(scrollY / m_CharAdvance.y)); - int bottom = static_cast(ImCeil((scrollY + height) / m_CharAdvance.y)); + float top = 1.0f + ImCeil(scrollY / m_CharAdvance.y); + float bottom = ImCeil((scrollY + height) / m_CharAdvance.y); - int left = static_cast(ImCeil(scrollX / m_CharAdvance.x)); - int right = static_cast(ImCeil((scrollX + width) / m_CharAdvance.x)); + float left = ImCeil(scrollX / m_CharAdvance.x); + float right = ImCeil((scrollX + width) / m_CharAdvance.x); if (pos.m_nColumn < left) ImGui::SetScrollX(ImMax(0.0f, (pos.m_nColumn) * m_CharAdvance.x));