()
| 860 | } |
| 861 | |
| 862 | private static void CompleteCommand() { |
| 863 | |
| 864 | int start = 1; |
| 865 | if (ClientGlobals.key_lines[ClientGlobals.edit_line][start] == '\\' || ClientGlobals.key_lines[ClientGlobals.edit_line][start] == '/') |
| 866 | start++; |
| 867 | |
| 868 | int end = start; |
| 869 | while (ClientGlobals.key_lines[ClientGlobals.edit_line][end] != 0) end++; |
| 870 | |
| 871 | String s = new String(ClientGlobals.key_lines[ClientGlobals.edit_line], start, end-start); |
| 872 | |
| 873 | List<String> cmds = Cmd.CompleteCommand(s); |
| 874 | List<String> vars = Cvar.getInstance().CompleteVariable(s); |
| 875 | |
| 876 | int commandsSize = cmds.size(); |
| 877 | int cvarsSize = vars.size(); |
| 878 | |
| 879 | if ((commandsSize + cvarsSize) > 1) { |
| 880 | if (commandsSize > 0) printCompletions("\nCommands:\n", cmds); |
| 881 | if (cvarsSize > 0) printCompletions("\nVariables:\n", vars); |
| 882 | return; |
| 883 | } else if (commandsSize == 1) { |
| 884 | s = cmds.get(0); |
| 885 | } else if (cvarsSize == 1) { |
| 886 | s = vars.get(0); |
| 887 | } else return; |
| 888 | |
| 889 | ClientGlobals.key_lines[ClientGlobals.edit_line][1] = '/'; |
| 890 | byte[] bytes = Lib.stringToBytes(s); |
| 891 | System.arraycopy(bytes, 0, ClientGlobals.key_lines[ClientGlobals.edit_line], 2, bytes.length); |
| 892 | ClientGlobals.key_linepos = bytes.length + 2; |
| 893 | ClientGlobals.key_lines[ClientGlobals.edit_line][ClientGlobals.key_linepos++] = ' '; |
| 894 | ClientGlobals.key_lines[ClientGlobals.edit_line][ClientGlobals.key_linepos] = 0; |
| 895 | } |
| 896 | |
| 897 | private static void Key_Bind_f(List<String> args) { |
| 898 |
no test coverage detected