From d22806436175b9e6da144106f5ba9828fe1da4c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 19 Dec 2023 22:10:44 +0100 Subject: [PATCH] Fix console selection not adjusted anymore when entries added The current mouse-based console selection was not being adjusted anymore when new lines are added to the console, as the `m_NewLineCounter` variable was decremented to `0` before the relevant check for `m_NewLineCounter > 0`. --- src/game/client/components/console.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index 62d5ed998..a0009c835 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -1054,8 +1054,17 @@ void CGameConsole::OnRender() pConsole->PumpBacklogPending(); if(pConsole->m_NewLineCounter > 0) + { pConsole->UpdateSearch(); + // keep scroll position when new entries are printed. + if(pConsole->m_BacklogCurLine != 0) + { + pConsole->m_BacklogCurLine += pConsole->m_NewLineCounter; + pConsole->m_BacklogLastActiveLine += pConsole->m_NewLineCounter; + } + } + // render console log (current entry, status, wrap lines) CInstance::CBacklogEntry *pEntry = pConsole->m_Backlog.Last(); float OffsetY = 0.0f; @@ -1085,17 +1094,6 @@ void CGameConsole::OnRender() pConsole->UpdateEntryTextAttributes(pEntry); LineNum += pEntry->m_LineCount; - while(pConsole->m_NewLineCounter > 0) - { - --pConsole->m_NewLineCounter; - - // keep scroll position when new entries are printed. - if(pConsole->m_BacklogCurLine != 0) - { - pConsole->m_BacklogCurLine++; - pConsole->m_BacklogLastActiveLine++; - } - } if(LineNum < pConsole->m_BacklogLastActiveLine) { SkippedLines += pEntry->m_LineCount; @@ -1182,6 +1180,10 @@ void CGameConsole::OnRender() // reset color TextRender()->TextColor(TextRender()->DefaultTextColor()); + if(pConsole->m_NewLineCounter > 0) + { + --pConsole->m_NewLineCounter; + } First = false; if(!pEntry)