public TextEditor(TextDocument document)
        {
            this.document = document;

            document.TextReplaced += (sender, args) =>
            {
                UpdateContentSize();
            };

            CaretAnimation = new CaretAnimation();
            Caret          = new Caret(this);
            Caret.Line     = 1;
            Options        = new TextEditorOptions();
            Content        = textArea = new TextArea(this);

            CaretAnimation.Callback = () =>
            {
                //RedrawLine(Caret.Line);
            };
            CaretAnimation.Start();

            Caret.PositionChanged += (sender, e) =>
            {
                QueueDraw();
            };

            KeyPressed += textArea.HandleKeyPressed;
            TextInput  += textArea.HandleTextInput;
        }
Example #2
0
        public TextEditor(TextDocument document)
        {
            this.document = document;

            document.TextReplaced += (sender, args) =>
            {
                UpdateContentSize();
            };

            CaretAnimation = new CaretAnimation();
            Caret = new Caret(this);
            Caret.Line = 1;
            Options = new TextEditorOptions();
            Content = textArea = new TextArea(this);

            CaretAnimation.Callback = () =>
            {
                //RedrawLine(Caret.Line);
            };
            CaretAnimation.Start();

            Caret.PositionChanged += (sender, e) =>
            {
                QueueDraw();
            };
            
            KeyPressed += textArea.HandleKeyPressed;
            TextInput += textArea.HandleTextInput;
        }