// Tab across to the next stop, or perform tab completion. private static void Tab(String prompt) { if (TabComplete == null) { // Add the TAB character and repaint the line. AddChar('\t'); } else { // Perform tab completion and insert the results. TabCompleteEventArgs e; e = new TabCompleteEventArgs (new String(buffer, 0, posn), new String(buffer, posn, length - posn)); TabComplete(null, e); if (e.Insert != null) { // Insert the value that we found. bool saveOverwrite = overwrite; overwrite = false; foreach (char ch in e.Insert) { AddChar(ch); } overwrite = saveOverwrite; } else if (e.Alternatives != null && e.Alternatives.Length > 0) { // Print the alternatives for the user. int savePosn = posn; EndLine(); PrintAlternatives(e.Alternatives); if (prompt != null) { Console.Write(prompt); } posn = savePosn; Redraw(); } else { // No alternatives, or alternatives not supplied yet. Console.Beep(); } } }
// Tab across to the next stop, or perform tab completion. private static void Tab(String prompt) { if(TabComplete == null) { // Add the TAB character and repaint the line. AddChar('\t'); } else { // Perform tab completion and insert the results. TabCompleteEventArgs e; e = new TabCompleteEventArgs (new String(buffer, 0, posn), new String(buffer, posn, length - posn)); TabComplete(null, e); if(e.Insert != null) { // Insert the value that we found. bool saveOverwrite = overwrite; overwrite = false; foreach(char ch in e.Insert) { AddChar(ch); } overwrite = saveOverwrite; } else if(e.Alternatives != null && e.Alternatives.Length > 0) { // Print the alternatives for the user. int savePosn = posn; EndLine(); PrintAlternatives(e.Alternatives); if(prompt != null) { Console.Write(prompt); } posn = savePosn; Redraw(); } else { // No alternatives, or alternatives not supplied yet. Console.Beep(); } } }