Example #1
0
        /// <summary>
        /// Handle text insert and delete events.
        /// </summary>
        /// <param name="s"></param>
        /// <param name="e"></param>
        private void HandleInsertAndDelete(object s, ModificationEventArgs e)
        {
            // internal function
            void HandleModificationEvent(ModificationEventArgs ev)
            {
                var first = LineFromPosition(ev.Position);
                var last  = first + ev.LinesAdded;

                UpdateCodeFolding(Math.Min(first, last), Math.Max(first, last));
            }

            FxLexer.Style(this, e.Position, TextLength);

            // update line number margins
            if (e.LinesAdded != 0)
            {
                UpdateLineNumbers();
                HandleModificationEvent(e);
            }
            // update code folding
            else if (e.Text.LastIndexOfAny(new[] { '{', '}' }) >= 0)
            {
                HandleModificationEvent(e);
            }
        }
Example #2
0
 public void TestLexing()
 {
     lexer.Style(editor, 0, editor.TextLength);
 }