void SetupConsole ()
{
if (is_unix){
string term = Environment.GetEnvironmentVariable ("TERM");
dumb = term == "dumb" || term == null || isatty == false;
} else
dumb = false;
editor = new Mono.Terminal.LineEditor ("csharp", 300);
InteractiveBaseShell.Editor = editor;
editor.AutoCompleteEvent += delegate (string s, int pos){
string prefix = null;
string complete = s.Substring (0, pos);
string [] completions = Evaluator.GetCompletions (complete, out prefix);
return new Mono.Terminal.LineEditor.Completion (prefix, completions);
};
#if false
//
// This is a sample of how completions sould be implemented.
//
editor.AutoCompleteEvent += delegate (string s, int pos){
// Single match: "Substring": Sub-string
if (s.EndsWith ("Sub")){
return new string [] { "string" };
}
// Multiple matches: "ToString" and "ToLower"
if (s.EndsWith ("T")){
return new string [] { "ToString", "ToLower" };
}
return null;
};
#endif
Console.CancelKeyPress += ConsoleInterrupt;
}