private string[] BuildCompletionList(CommandLineBuffer currentCommandLine)
        {
            var commandLine    = currentCommandLine.ToString();
            var tokens         = CommandLine.Split(commandLine);
            var completionType = GetCompletionType(tokens);

            switch (completionType)
            {
            case CompletionType.Command:
                break;

            case CompletionType.Directory:
                break;

            case CompletionType.File:
                break;

            case CompletionType.FileAndDirectory:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(null);
        }
 public string[] NextAutoComplete(CommandLineBuffer currentCommandLine)
 {
     if (!_isCompleting)
     {
         return(InitCompletion(currentCommandLine));
     }
     return(new[] { _navigator.GoNext() });
 }
        private string[] InitCompletion(CommandLineBuffer currentCommandLine)
        {
            _isCompleting = true;
            var completionList = BuildCompletionList(currentCommandLine);

            _navigator = new CompletionListNavigator(completionList);
            return(completionList);
        }
        public void Write(CommandLineBuffer history)
        {
            var spaces = _cursorLimit - history.Length;

            _console.SetCursorPosition(_initialLeft, _initialTop);
            _console.Write(history);
            if (spaces > 0)
            {
                WriteInPlace(String.Concat(Enumerable.Repeat(' ', spaces)));
            }
            _cursorPos = _cursorLimit = history.Length;
        }
 public void Write(CommandLineBuffer buffer, char c)
 {
     if (IsEndOfLine())
     {
         buffer.Append(c);
         _console.Write(c);
         _cursorPos++;
     }
     else
     {
         var str = buffer.ToString().Substring(_cursorPos);
         buffer.Insert(_cursorPos, c);
         WriteInPlace(c + str);
         MoveCursorRight();
     }
     IncrementCursorLimit();
 }
 public void Backspace(CommandLineBuffer buffer)
 {
     if (!IsStartOfLine())
     {
         buffer.Remove(_cursorPos - 1, 1);
         var isEndOfLine = IsEndOfLine();
         MoveCursorLeft();
         var value = " ";
         if (!isEndOfLine)
         {
             var str = buffer.ToString().Substring(_cursorPos);
             value = str + value;
         }
         WriteInPlace(value);
         DecrementCursorLimit();
     }
 }