diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index be21fb2ab..4aaf0fc9a 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -150,6 +150,35 @@ bool CChat::OnInput(IInput::CEvent Event) Input()->SetClipboardText(m_Input.GetString()); } + if(Input()->KeyIsPressed(KEY_LCTRL)) // jump to spaces and special ASCII characters + { + int SearchDirection = 0; + if(Input()->KeyPress(KEY_LEFT)) + SearchDirection = -1; + else if(Input()->KeyPress(KEY_RIGHT)) + SearchDirection = 1; + + if(SearchDirection != 0) + { + int FoundAt = SearchDirection > 0 ? m_Input.GetLength()-1 : 0; + for(int i = m_Input.GetCursorOffset()+SearchDirection; SearchDirection > 0 ? i < m_Input.GetLength()-1 : i > 0; i+=SearchDirection) + { + int next = i+SearchDirection; + if( (m_Input.GetString()[next] == ' ') || + (m_Input.GetString()[next] >= 32 && m_Input.GetString()[next] <= 47) || + (m_Input.GetString()[next] >= 58 && m_Input.GetString()[next] <= 64) || + (m_Input.GetString()[next] >= 91 && m_Input.GetString()[next] <= 96) ) + { + FoundAt = i; + if(SearchDirection < 0) + FoundAt++; + break; + } + } + m_Input.SetCursorOffset(FoundAt); + } + } + if(Event.m_Flags&IInput::FLAG_PRESS && Event.m_Key == KEY_ESCAPE) { m_Mode = MODE_NONE;