Exemple #1
0
        private void scintilla_SCNotification(object sender, SCNotificationEventArgs e)
        {
            // We only care about modifications that add/delete lines
            NativeMethods.SCNotification scn = e.Notification;
            if (scn.nmhdr.code != NativeMethods.SCN_MODIFIED)
            {
                return;
            }
            else if (scn.linesAdded == 0)
            {
                return;
            }

            // Update the line data list
            int lineIndex = (int)_scintilla.DirectMessage(NativeMethods.SCI_LINEFROMPOSITION, new IntPtr(scn.position), IntPtr.Zero);

            if (scn.linesAdded < 0)
            {
                _lineData.RemoveRange(lineIndex + 1, Math.Abs(scn.linesAdded));
            }
            else
            {
                _lineData.InsertRange(lineIndex + 1, new LineStorageData[scn.linesAdded]);
            }

            Debug.Assert(_lineData.Count == _scintilla.Lines.Count);
        }
Exemple #2
0
        private void scintilla_SCNotification(object sender, SCNotificationEventArgs e)
        {
            // We only care about text modifications
            NativeMethods.SCNotification scn = e.Notification;
            if (scn.nmhdr.code != NativeMethods.SCN_MODIFIED)
            {
                return;
            }

            bool invalidateCache = false;

            invalidateCache |= ((scn.modificationType & NativeMethods.SC_MOD_INSERTTEXT) == NativeMethods.SC_MOD_INSERTTEXT);
            invalidateCache |= ((scn.modificationType & NativeMethods.SC_MOD_DELETETEXT) == NativeMethods.SC_MOD_DELETETEXT);

            if (invalidateCache)
            {
                int lineIndexModified = (int)_scintilla.DirectMessage(NativeMethods.SCI_LINEFROMPOSITION, new IntPtr(scn.position), IntPtr.Zero);
                InvalidateCache(lineIndexModified, (scn.linesAdded > 0 ? scn.linesAdded : 0));
            }
        }
 public SCNotificationEventArgs(NativeMethods.SCNotification notification)
 {
     _notification = notification;
 }
 public SCNotificationEventArgs(NativeMethods.SCNotification notification)
 {
     _notification = notification;
 }