From 963c189f354d57452ea911b4e233f644e2170b6d Mon Sep 17 00:00:00 2001 From: Amos <48657826+Mauler125@users.noreply.github.com> Date: Thu, 20 Jan 2022 00:24:41 +0100 Subject: [PATCH] Reset scroll position when AutoSuggest has updated --- r5dev/gameui/IConsole.cpp | 7 +++++++ r5dev/gameui/IConsole.h | 1 + r5dev/tier0/IConVar.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/r5dev/gameui/IConsole.cpp b/r5dev/gameui/IConsole.cpp index a5fbe992..1a939d86 100644 --- a/r5dev/gameui/IConsole.cpp +++ b/r5dev/gameui/IConsole.cpp @@ -315,6 +315,12 @@ void CConsole::SuggestPanel(void) m_bSuggestMoved = false; } } + + if (m_bSuggestUpdate) + { + ImGui::SetScrollHereY(0.f); + m_bSuggestUpdate = false; + } } ImGui::PopAllowKeyboardFocus(); @@ -364,6 +370,7 @@ bool CConsole::CanAutoComplete(void) void CConsole::FindFromPartial(void) { m_nSuggestPos = -1; + m_bSuggestUpdate = true; m_vsvSuggest.clear(); for (int i = 0; i < g_vsvAllConVars.size(); i++) diff --git a/r5dev/gameui/IConsole.h b/r5dev/gameui/IConsole.h index ef50f9b6..7ffaad9c 100644 --- a/r5dev/gameui/IConsole.h +++ b/r5dev/gameui/IConsole.h @@ -21,6 +21,7 @@ private: std::vector m_vsvSuggest; bool m_bSuggestActive = false; bool m_bSuggestMoved = false; + bool m_bSuggestUpdate = false; int m_nSuggestPos = -1; ImVec2 m_vecSuggestWindowPos; diff --git a/r5dev/tier0/IConVar.cpp b/r5dev/tier0/IConVar.cpp index f056f39b..9a5825b5 100644 --- a/r5dev/tier0/IConVar.cpp +++ b/r5dev/tier0/IConVar.cpp @@ -76,7 +76,7 @@ void ConVar::Init(void) cl_gpustats_offset_x = new ConVar("cl_gpustats_offset_x", "1250", FCVAR_DEVELOPMENTONLY, "X offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr); cl_gpustats_offset_y = new ConVar("cl_gpustats_offset_y", "900", FCVAR_DEVELOPMENTONLY, "Y offset for texture streaming debug overlay.", false, 0.f, false, 0.f, nullptr, nullptr); - con_suggestion_limit = new ConVar("con_suggestion_limit", "40", FCVAR_DEVELOPMENTONLY, "Maximum number of suggestions the autocomplete window will show for the console.", false, 0.f, false, 0.f, nullptr, nullptr); + con_suggestion_limit = new ConVar("con_suggestion_limit", "120", FCVAR_DEVELOPMENTONLY, "Maximum number of suggestions the autocomplete window will show for the console.", false, 0.f, false, 0.f, nullptr, nullptr); con_suggestion_helptext = new ConVar("con_suggestion_helptext", "0", FCVAR_DEVELOPMENTONLY, "Show ConVar help text in autocomplete window. Disabled by default to keep window less populated.", false, 0.f, false, 0.f, nullptr, nullptr); //------------------------------------------------------------------------- // FILESYSTEM |