public void AutoComplete() { if (_buffer.Length == 0) { return; } string argCompletionStr = string.Empty; if (_autoComplete == null) { _autoComplete = new UI.AutoComplete(); idCmdArgs args = new idCmdArgs(_buffer.ToString(), true); argCompletionStr = args.ToString(); _autoComplete.CompletionString = args.Get(0); _autoComplete.MatchCount = 0; _autoComplete.MatchIndex = 0; string[] matches = idE.CmdSystem.CommandCompletion(new Predicate <string>(FindMatch)); if (matches.Length > 1) { foreach (string s in matches) { idConsole.WriteLine(" {0}", s); } } matches = idE.CvarSystem.CommandCompletion(new Predicate <string>(FindMatch)); if (matches.Length > 1) { foreach (string s in matches) { idConsole.WriteLine(" {0} {1}= \"{2}\"", s, idColorString.White, idE.CvarSystem.GetString(s)); } } else if (matches.Length == 1) { this.Buffer = string.Format("{0} ", matches[0]); string[] argMatches = idE.CvarSystem.ArgCompletion(matches[0], argCompletionStr); foreach (string s in argMatches) { idConsole.WriteLine(" {0}", s); } } } }
public void AutoComplete() { if(_buffer.Length == 0) { return; } string argCompletionStr = string.Empty; if(_autoComplete == null) { _autoComplete = new UI.AutoComplete(); idCmdArgs args = new idCmdArgs(_buffer.ToString(), true); argCompletionStr = args.ToString(); _autoComplete.CompletionString = args.Get(0); _autoComplete.MatchCount = 0; _autoComplete.MatchIndex = 0; string[] matches = idE.CmdSystem.CommandCompletion(new Predicate<string>(FindMatch)); if(matches.Length > 1) { foreach(string s in matches) { idConsole.WriteLine(" {0}", s); } } matches = idE.CvarSystem.CommandCompletion(new Predicate<string>(FindMatch)); if(matches.Length > 1) { foreach(string s in matches) { idConsole.WriteLine(" {0} {1}= \"{2}\"", s, idColorString.White, idE.CvarSystem.GetString(s)); } } else if(matches.Length == 1) { this.Buffer = string.Format("{0} ", matches[0]); string[] argMatches = idE.CvarSystem.ArgCompletion(matches[0], argCompletionStr); foreach(string s in argMatches) { idConsole.WriteLine(" {0}", s); } } } }