public ConsoleInputHandler(IConsole console,
                            IConsoleWriter consoleWriter,
                            IKeyHandler keyHandler,
                            IHistoryNavigator historyNavigator,
                            IPromptProvider promptProvider)
 {
     _console          = console;
     _consoleWriter    = consoleWriter;
     _keyHandler       = keyHandler;
     _historyNavigator = historyNavigator;
     _promptProvider   = promptProvider;
 }
Example #2
0
        public KeyHandler(IConsole console,
                          IConsoleWriter writer,
                          IPromptProvider promptProvider,
                          IHistoryNavigator historyNavigator,
                          ICompletionNavigator completionNavigator,
                          ICompletionWriter completionWriter)
        {
            _console             = console;
            _writer              = writer;
            _promptProvider      = promptProvider;
            _historyNavigator    = historyNavigator;
            _completionNavigator = completionNavigator;
            _completionWriter    = completionWriter;
            AddHandler(_writer.MoveCursorLeft, Seqs.ControlB, Seqs.LeftArrow);
            AddHandler(_writer.MoveCursorRight, Seqs.ControlF, Seqs.RightArrow);

            AddHandler(_writer.MoveCursorHome, Seqs.ControlA, Seqs.Home);

            AddHandler(_writer.MoveCursorEnd, Seqs.ControlE, Seqs.End);

            AddHandler(Backspace, Seqs.ControlH, Seqs.Backspace);

            AddHandler(ClearScreen, Seqs.ControlL);

            AddHandler(PreviousHistory, Seqs.ControlP, Seqs.UpArrow);
            AddHandler(NextHistory, Seqs.ControlN, Seqs.DownArrow);

            AddHandler(BreakProcess, Seqs.ControlC);

            AddHandler(NextAutoComplete, Seqs.Tab);
            AddHandler(PrevAutoComplete, Seqs.ShiftTab);

            // Cmder specific features
            //AddHandler(TraverseUpDirectory, Seqs.ControlAltU);

            // Gnu Readline https://en.wikipedia.org/wiki/GNU_Readline
            //AddHandler(DeleteNextChar, Seqs.ControlD);

            //AddHandler(SearchHistoryUp, Seqs.ControlR);
            //AddHandler(SearchHistoryDown, Seqs.ControlS);

            // Undo
            //AddHandler(Undo, Seqs.ControlUnderscore, Seqs.ControlXControlU);
            //_handlers.Add(BuildKey(ConsoleKey.Underscore, Console.Control), Undo);
        }