public EditorContext() {
            Postbox = Postbox.InstanceFor(EditorCode);
            Configuration.ConfigManager.AddEditorConfig(EditorCode, new Configuration.Config {
                Language = SupportedLanguages.JS,
                FormattingType = FormattingType.BRACKETS
            });

            TextsToEnter = new List<string>();
            CaretView = new CaretView();
            TextView = new TextView(CaretView);
            SelectionView = new SelectionView(TextView);
            LinesView = new LinesView();
            FoldingView = new FoldingView();
            EnterTextCommand = new EnterTextCommand(TextView, CaretView, SelectionView);
            RemoveTextCommand = new RemoveTextCommand(TextView, CaretView, SelectionView);
            CaretMoveCommand = new CaretMoveCommand(CaretView, TextView);
            SelectionCommand = new TextSelectionCommand(TextView, SelectionView, CaretView);
            
            CaretView.EditorCode = EditorCode;
            CaretView.Postbox = Postbox;
            TextView.EditorCode = EditorCode;
            TextView.Postbox = Postbox;
            SelectionView.EditorCode = EditorCode;
            SelectionView.Postbox = Postbox;
            LinesView.EditorCode = EditorCode;
            LinesView.Postbox = Postbox;
            FoldingView.EditorCode = EditorCode;
            FoldingView.Postbox = Postbox;

            InitEvents();
            ForceDraw();
        }
        protected override void OnKeyDown(KeyEventArgs e) {
            var removeTextCmd = new RemoveTextCommand(textView, caretView, selectionView);
            var caretMoveCmd = new CaretMoveCommand(caretView, textView);
            var selectionCmd = new TextSelectionCommand(textView, selectionView, caretView);
            var deselectionCmd = new TextDeselectionCommand(selectionView);

            if (removeTextCmd.CanExecute(e)) {
                ExecuteTextCommand(removeTextCmd, new UndoRemoveTextCommand(textView, caretView), e);
                deselectionCmd.Execute();
            } else if (caretMoveCmd.CanExecute(e)) {
                caretMoveCmd.Execute(e);
                deselectionCmd.Execute();
            } else if (selectionCmd.CanExecute(e)) {
                selectionCmd.Execute(e);
            }
        }
 protected override void OnMouseMove(MouseEventArgs e) {
     var selectionCmd = new TextSelectionCommand(textView, selectionView, caretView);
     var canExecuteSelection = selectionCmd.CanExecute(e);
     
     if (canExecuteSelection) {
         selectionCmd.Execute(e);
     }
 }
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) {
            var selectionCmd = new TextSelectionCommand(textView, selectionView, caretView);

            if (selectionCmd.CanExecute(e)) {
                selectionCmd.Execute(e);
            }
        }