Provices data for the TextModified event
TextModifiedEventHandler is used as an abstracted subset of the SCN_MODIFIED notification message. It's used whenever the SCNotification's modificationType flags are SC_MOD_INSERTTEXT ,SC_MOD_DELETETEXT, SC_MOD_BEFOREINSERT and SC_MOD_BEFORE_DELETE. They all use a TextModifiedEventArgs which corresponds to a subset of the SCNotification struct having to do with these modification types.
Inheritance: ModifiedEventArgs
示例#1
0
 private void Scintilla_BeforeTextInsert(object sender, TextModifiedEventArgs e)
 {
     if (this._snippetLinks.IsActive && !this._pendingUndo && !(e.UndoRedoFlags.IsUndo || e.UndoRedoFlags.IsRedo))
     {
         this._pendingUndo = true;
         Scintilla.UndoRedo.BeginUndoAction();
         this._snippetLinkTimer.Enabled = true;
     }
 }
示例#2
0
 private void Scintilla_TextInserted(object sender, TextModifiedEventArgs e)
 {
     //	I'm going to have to look into making this a little less "sledge hammer to
     //	the entire documnet"ish
     if (this._snippetLinks.IsActive && (e.UndoRedoFlags.IsUndo || e.UndoRedoFlags.IsRedo))
         Scintilla.NativeInterface.Colourise(0, -1);
 }
示例#3
0
        private void Scintilla_BeforeTextDelete(object sender, TextModifiedEventArgs e)
        {
            if (!this._isEnabled)
                return;

            if (this._snippetLinks.IsActive && !this._pendingUndo && !(e.UndoRedoFlags.IsUndo || e.UndoRedoFlags.IsRedo))
            {
                this._pendingUndo = true;
                Scintilla.UndoRedo.BeginUndoAction();
                this._snippetLinkTimer.Enabled = true;
            }

            ManagedRange undoneSnippetLinkRange = null;
            if (e.UndoRedoFlags.IsUndo && this._snippetLinks.IsActive)
            {
                foreach (ManagedRange mr in Scintilla.ManagedRanges)
                {
                    if (mr.Start == e.Position && mr.Length == e.Length && mr.Length > 1)
                    {
                        undoneSnippetLinkRange = mr;

                        //	Expanding the range So that it won't get marked for deletion
                        mr.End++;
                    }
                }
            }

            //	It's possible that the _end point may have been deleted. The endpoint
            //	is an ultra persistent marker that cannot be deleted until the Snippet
            //	Link mode is deactivated. Place a new EndPoint at the begining of the
            //	deleted range.
            if (this._snippetLinks.IsActive && this._snippetLinks.EndPoint != null && this._snippetLinks.EndPoint.Scintilla == null)
            {
                var eci = new SnippetLinkEnd(e.Position, Scintilla);
                Scintilla.ManagedRanges.Add(eci);
                this._snippetLinks.EndPoint = eci;
            }

            //	Now collapse the Undone range in preparation for the
            //	newly inserted text that will be put in here
            if (undoneSnippetLinkRange != null)
                undoneSnippetLinkRange.End = undoneSnippetLinkRange.Start;

            //	Check to see if all SnippetLink ranges have been deleted.
            //	If this is the case we need to turn Deactivate SnippetLink
            //	mode.

            bool deactivate = true;
            foreach (SnippetLink sl in this._snippetLinks.Values)
            {
                if (sl.Ranges.Count > 0)
                {
                    foreach (SnippetLinkRange slr in sl.Ranges)
                    {
                        if (slr.Scintilla != null)
                        {
                            deactivate = false;
                            break;
                        }
                    }
                }
                if (!deactivate)
                    break;
            }

            if (deactivate && this.IsActive)
                this.IsActive = false;
        }