void Enqueue( ) { ConsoleKeyInfo _key = Console.ReadKey(true); onKeyPressed(new EventArgs <ConsoleKeyInfo>(_key)); switch (_key.Key) { case ConsoleKey.Backspace: if (!string.IsNullOrEmpty(CurrentLine.ToString( ))) { CurrentLine.Remove(CurrentLine.Length - 1, 1); onCurrentLineChanged(EventArgs.Empty); } break; case ConsoleKey.LeftArrow: case ConsoleKey.RightArrow: case ConsoleKey.UpArrow: case ConsoleKey.DownArrow: break; case ConsoleKey.Enter: InputLines.Enqueue(CurrentLine.ToString( )); CurrentLine.Clear( ); onCurrentLineChanged(EventArgs.Empty); onNewInputLineAdded(EventArgs.Empty); break; default: CurrentLine.Append(_key.KeyChar); onCurrentLineChanged(EventArgs.Empty); break; } }
public void ReplaceAllLineContent(EditableRun[] runs) { int charIndex = CharIndex; CurrentLine.Clear(); int j = runs.Length; for (int i = 0; i < j; ++i) { CurrentLine.AddLast(runs[i]); } EnsureCurrentTextRun(charIndex); }
public void Clear() { this.MoveToLine(0); CurrentLine.Clear(); EnsureCurrentTextRun(); }
public void NewLine() { lines.Add(CurrentLine.ToString()); CurrentLine.Clear(); }