mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
added ':' after names on start and a space separator in chat tab completion
This commit is contained in:
parent
9efa0e3f63
commit
4f402f85bb
|
@ -162,10 +162,25 @@ bool CChat::OnInput(IInput::CEvent Event)
|
|||
if(pCompletionString)
|
||||
{
|
||||
char aBuf[256];
|
||||
// add part before the name
|
||||
str_copy(aBuf, m_Input.GetString(), min(static_cast<int>(sizeof(aBuf)), m_PlaceholderOffset+1));
|
||||
|
||||
// add the name
|
||||
str_append(aBuf, pCompletionString, sizeof(aBuf));
|
||||
|
||||
// add seperator
|
||||
const char *pSeparator = "";
|
||||
if(*(m_Input.GetString()+m_PlaceholderOffset+m_PlaceholderLength) != ' ')
|
||||
pSeparator = m_PlaceholderOffset == 0 ? ": " : " ";
|
||||
else if(m_PlaceholderOffset == 0)
|
||||
pSeparator = ":";
|
||||
if(*pSeparator)
|
||||
str_append(aBuf, pSeparator, sizeof(aBuf));
|
||||
|
||||
// add part after the name
|
||||
str_append(aBuf, m_Input.GetString()+m_PlaceholderOffset+m_PlaceholderLength, sizeof(aBuf));
|
||||
m_PlaceholderLength = str_length(pCompletionString);
|
||||
|
||||
m_PlaceholderLength = str_length(pSeparator)+str_length(pCompletionString);
|
||||
m_OldChatStringLength = m_Input.GetLength();
|
||||
m_Input.Set(aBuf);
|
||||
m_Input.SetCursorOffset(m_PlaceholderOffset+m_PlaceholderLength);
|
||||
|
|
Loading…
Reference in a new issue