MCPcopy Create free account
hub / github.com/ddnet/ddnet / PossibleCommandsCompleteCallback

Method PossibleCommandsCompleteCallback

src/game/client/components/console.cpp:454–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452}
453
454void CGameConsole::CInstance::PossibleCommandsCompleteCallback(int Index, const char *pStr, void *pUser)
455{
456 CGameConsole::CInstance *pInstance = (CGameConsole::CInstance *)pUser;
457 if(pInstance->m_CompletionChosen == Index)
458 {
459 char aBefore[IConsole::CMDLINE_LENGTH];
460 str_truncate(aBefore, sizeof(aBefore), pInstance->m_aCompletionBuffer, pInstance->m_CompletionCommandStart);
461 char aBuf[IConsole::CMDLINE_LENGTH];
462 str_format(aBuf, sizeof(aBuf), "%s%s%s", aBefore, pStr, pInstance->m_aCompletionBuffer + pInstance->m_CompletionCommandEnd);
463 pInstance->m_Input.Set(aBuf);
464 pInstance->m_Input.SetCursorOffset(str_length(pStr) + pInstance->m_CompletionCommandStart);
465 }
466}
467
468void CGameConsole::CInstance::GetCommand(const char *pInput, char (&aCmd)[IConsole::CMDLINE_LENGTH])
469{

Callers

nothing calls this directly

Calls 5

str_truncateFunction · 0.85
str_formatFunction · 0.85
str_lengthFunction · 0.85
SetCursorOffsetMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected