/// <summary>
        /// Initializes a new instance of the <see cref="LineCollection" /> class.
        /// </summary>
        /// <param name="scintilla">The <see cref="Scintilla" /> control that created this collection.</param>
        public LineCollection(Scintilla scintilla)
        {
            this.scintilla = scintilla;
            this.scintilla.SCNotification += scintilla_SCNotification;

            this.perLineData = new GapBuffer <PerLine>();
            this.perLineData.Add(new PerLine {
                Start = 0
            });
            this.perLineData.Add(new PerLine {
                Start = 0
            });                                              // Terminal
        }
        internal void RebuildLineData()
        {
            stepLine   = 0;
            stepLength = 0;

            perLineData = new GapBuffer <PerLine>();
            perLineData.Add(new PerLine {
                Start = 0
            });
            perLineData.Add(new PerLine {
                Start = 0
            });                                         // Terminal

            // Fake an insert notification
            var scn = new NativeMethods.SCNotification();

            scn.linesAdded = scintilla.DirectMessage(NativeMethods.SCI_GETLINECOUNT).ToInt32() - 1;
            scn.position   = 0;
            scn.length     = scintilla.DirectMessage(NativeMethods.SCI_GETLENGTH).ToInt32();
            scn.text       = scintilla.DirectMessage(NativeMethods.SCI_GETRANGEPOINTER, new IntPtr(scn.position), new IntPtr(scn.length));
            TrackInsertText(scn);
        }