about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-06-09 23:37:59 +0200
committeroy <Tom_Adams@web.de>2011-06-09 23:37:59 +0200
commit4f402f85bbe3b4e9f69e3bcf5ca63d9b100d77de (patch)
tree3e946dff1da5e725a7c3cd307df6fb2b48e47a7e /src/game
parent9efa0e3f63cb567c88acd1a9fd775eca5041cd9f (diff)
downloadzcatch-4f402f85bbe3b4e9f69e3bcf5ca63d9b100d77de.tar.gz
zcatch-4f402f85bbe3b4e9f69e3bcf5ca63d9b100d77de.zip
added ':' after names on start and a space separator in chat tab completion
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/components/chat.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp
index 8a456009..c8d09ba8 100644
--- a/src/game/client/components/chat.cpp
+++ b/src/game/client/components/chat.cpp
@@ -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);