diff -r 0e947b487b18 -r 4f7c2c944637 sources/interface.cpp --- a/sources/interface.cpp Mon May 04 18:16:05 2015 +0300 +++ b/sources/interface.cpp Fri May 15 18:36:22 2015 +0300 @@ -803,6 +803,20 @@ } break; + case '\t': + { + int space = current_input().find (" "); + + if (CurrentInputState == INPUTSTATE_NORMAL + and InputCursor > 0 + and (space == -1 or space >= InputCursor)) + { + String start = current_input().mid (0, InputCursor); + RCONSession::get_session()->request_tab_complete (start); + } + } + break; + case '\n': case KEY_ENTER: switch (CurrentInputState) @@ -892,6 +906,8 @@ } break; } + + render(); } // ------------------------------------------------------------------------------------------------- @@ -978,3 +994,21 @@ PlayerNames = names; NeedNicklistRender = true; } + +// ------------------------------------------------------------------------------------------------- +// +FUNCTION +Interface::tab_complete (const String& part, String complete) -> void +{ + String& input = mutable_current_input(); + + if (input.starts_with (part)) + { + if (input[part.length()] != ' ') + complete += ' '; + + input.replace (0, part.length(), complete); + InputCursor = complete.length(); + NeedInputRender = true; + } +}