sources/interface.cpp

changeset 71
4f7c2c944637
parent 69
eb4c25284a19
parent 41
9ab869656b9e
child 72
1b9c53e0c846
equal deleted inserted replaced
70:0e947b487b18 71:4f7c2c944637
801 CursorPosition += PasteBuffer.length(); 801 CursorPosition += PasteBuffer.length();
802 NeedInputRender = true; 802 NeedInputRender = true;
803 } 803 }
804 break; 804 break;
805 805
806 case '\t':
807 {
808 int space = current_input().find (" ");
809
810 if (CurrentInputState == INPUTSTATE_NORMAL
811 and InputCursor > 0
812 and (space == -1 or space >= InputCursor))
813 {
814 String start = current_input().mid (0, InputCursor);
815 RCONSession::get_session()->request_tab_complete (start);
816 }
817 }
818 break;
819
806 case '\n': 820 case '\n':
807 case KEY_ENTER: 821 case KEY_ENTER:
808 switch (CurrentInputState) 822 switch (CurrentInputState)
809 { 823 {
810 case INPUTSTATE_CONFIRM_DISCONNECTION: 824 case INPUTSTATE_CONFIRM_DISCONNECTION:
890 else if (CurrentInputState == INPUTSTATE_ADDRESS) 904 else if (CurrentInputState == INPUTSTATE_ADDRESS)
891 set_input_state (INPUTSTATE_NORMAL); 905 set_input_state (INPUTSTATE_NORMAL);
892 } 906 }
893 break; 907 break;
894 } 908 }
909
910 render();
895 } 911 }
896 912
897 // ------------------------------------------------------------------------------------------------- 913 // -------------------------------------------------------------------------------------------------
898 // 914 //
899 FUNCTION 915 FUNCTION
976 Interface::set_player_names (const StringList& names) -> void 992 Interface::set_player_names (const StringList& names) -> void
977 { 993 {
978 PlayerNames = names; 994 PlayerNames = names;
979 NeedNicklistRender = true; 995 NeedNicklistRender = true;
980 } 996 }
997
998 // -------------------------------------------------------------------------------------------------
999 //
1000 FUNCTION
1001 Interface::tab_complete (const String& part, String complete) -> void
1002 {
1003 String& input = mutable_current_input();
1004
1005 if (input.starts_with (part))
1006 {
1007 if (input[part.length()] != ' ')
1008 complete += ' ';
1009
1010 input.replace (0, part.length(), complete);
1011 InputCursor = complete.length();
1012 NeedInputRender = true;
1013 }
1014 }

mercurial