ShellMe.CommandLine.Console.LowLevel.LowLevelToAbstractConsoleAdapter.EraseCurrentLine C# (CSharp) Method

EraseCurrentLine() public method

public EraseCurrentLine ( ) : void
return void
        public void EraseCurrentLine()
        {
            while (!_cursorController.IsEndOfInput())
            {
                _cursorController.MoveCursorForward();
            }

            while (!_cursorController.IsStartOfInput())
            {
                OnBackspaceHit();
            }
        }

Usage Example

Exemplo n.º 1
0
        private void InitializeHistory(LowLevelToAbstractConsoleAdapter adapter)
        {
            var keyMap = new Dictionary<ConsoleKey, Func<HistoryEntry>>
                             {
                                 { ConsoleKey.UpArrow, () => _history.GetNextEntry() },
                                 { ConsoleKey.DownArrow, () => _history.GetPreviousEntry() }
                             };

            adapter.KeyStrokes
                .Select(keyInfo => keyInfo.Key)
                .Where(key => key == ConsoleKey.UpArrow || key == ConsoleKey.DownArrow)
                .Select(key => keyMap[key])
                .Subscribe(func =>
                               {
                                   adapter.EraseCurrentLine();
                                   var historyEntry = func();

                                   if (historyEntry != null)
                                   {
                                       adapter.Write(historyEntry.Value);
                                   }
                               });
        }
All Usage Examples Of ShellMe.CommandLine.Console.LowLevel.LowLevelToAbstractConsoleAdapter::EraseCurrentLine