mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
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`.
This commit is contained in:
parent
ddd10f2308
commit
d228064361
|
@ -1054,8 +1054,17 @@ void CGameConsole::OnRender()
|
||||||
|
|
||||||
pConsole->PumpBacklogPending();
|
pConsole->PumpBacklogPending();
|
||||||
if(pConsole->m_NewLineCounter > 0)
|
if(pConsole->m_NewLineCounter > 0)
|
||||||
|
{
|
||||||
pConsole->UpdateSearch();
|
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)
|
// render console log (current entry, status, wrap lines)
|
||||||
CInstance::CBacklogEntry *pEntry = pConsole->m_Backlog.Last();
|
CInstance::CBacklogEntry *pEntry = pConsole->m_Backlog.Last();
|
||||||
float OffsetY = 0.0f;
|
float OffsetY = 0.0f;
|
||||||
|
@ -1085,17 +1094,6 @@ void CGameConsole::OnRender()
|
||||||
pConsole->UpdateEntryTextAttributes(pEntry);
|
pConsole->UpdateEntryTextAttributes(pEntry);
|
||||||
|
|
||||||
LineNum += pEntry->m_LineCount;
|
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)
|
if(LineNum < pConsole->m_BacklogLastActiveLine)
|
||||||
{
|
{
|
||||||
SkippedLines += pEntry->m_LineCount;
|
SkippedLines += pEntry->m_LineCount;
|
||||||
|
@ -1182,6 +1180,10 @@ void CGameConsole::OnRender()
|
||||||
|
|
||||||
// reset color
|
// reset color
|
||||||
TextRender()->TextColor(TextRender()->DefaultTextColor());
|
TextRender()->TextColor(TextRender()->DefaultTextColor());
|
||||||
|
if(pConsole->m_NewLineCounter > 0)
|
||||||
|
{
|
||||||
|
--pConsole->m_NewLineCounter;
|
||||||
|
}
|
||||||
First = false;
|
First = false;
|
||||||
|
|
||||||
if(!pEntry)
|
if(!pEntry)
|
||||||
|
|
Loading…
Reference in a new issue