diff -r cf85b5f77541 -r 9ab869656b9e sources/interface.cpp --- a/sources/interface.cpp Mon Dec 15 20:18:56 2014 +0200 +++ b/sources/interface.cpp Mon Dec 15 20:19:18 2014 +0200 @@ -719,6 +719,19 @@ g_needOutputRender = true; break; + case '\t': + { + int space = current_input().find (" "); + + if (g_inputState == INPUTSTATE_NORMAL + and g_cursor > 0 + and (space == -1 or space >= g_cursor)) + { + RCONSession::get_session()->request_tab_complete (current_input().mid (0, g_cursor)); + } + } + break; + case '\n': case KEY_ENTER: switch (g_inputState) @@ -768,6 +781,8 @@ safe_disconnect ([]() {set_input_state (INPUTSTATE_ADDRESS);}); break; } + + render(); } // ------------------------------------------------------------------------------------------------- @@ -926,3 +941,21 @@ return max (rows, 1); } + +// ------------------------------------------------------------------------------------------------- +// +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); + g_cursor = complete.length(); + g_needInputRender = true; + } +}