private void WriteCharacterForPressedKey(ConsoleKeyInfo key) { var c = new ConsoleCharacter(key.KeyChar); if (CursorPosition == Context.Buffer.Count) { Context.Buffer.Add(c); } else { Context.Buffer.Insert(CursorPosition, c); } CursorPosition++; }