mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Quote names with spaces when auto completing.
This commit is contained in:
parent
6fc27bea8c
commit
7ca10e2645
|
@ -393,6 +393,19 @@ bool CChat::OnInput(const IInput::CEvent &Event)
|
|||
// add part before the name
|
||||
str_truncate(aBuf, sizeof(aBuf), m_Input.GetString(), m_PlaceholderOffset);
|
||||
|
||||
// quote the name
|
||||
char aQuoted[128];
|
||||
if(m_Input.GetString()[0] == '/' && (str_find(pCompletionString, " ") || str_find(pCompletionString, "\"")))
|
||||
{
|
||||
// escape the name
|
||||
str_copy(aQuoted, "\"");
|
||||
char *pDst = aQuoted + str_length(aQuoted);
|
||||
str_escape(&pDst, pCompletionString, aQuoted + sizeof(aQuoted));
|
||||
str_append(aQuoted, "\"");
|
||||
|
||||
pCompletionString = aQuoted;
|
||||
}
|
||||
|
||||
// add the name
|
||||
str_append(aBuf, pCompletionString);
|
||||
|
||||
|
|
Loading…
Reference in a new issue