示例#1
0
 private void Set(ScreenBufferLinesRange range)
 {
     lines.Clear();
     lines.AddRange(range.Lines);
     beginPosition = range.BeginPosition;
     endPosition   = range.EndPosition;
     if (Debugger.IsAttached)
     {
         VerifyInvariants();
     }
 }
示例#2
0
 private void Prepend(ScreenBufferLinesRange range)
 {
     diagnostics.VerifyPositionsOrderBeforeRangeConcatenation(
         range.EndPosition, beginPosition, source.HasConsecutiveMessages);
     lines.InsertRange(0, range.Lines);
     beginPosition = range.BeginPosition;
     if (Debugger.IsAttached)
     {
         VerifyInvariants();
     }
 }
示例#3
0
        public async Task LoadBefore(int nrOfLines, CancellationToken cancellation)
        {
            if (Count > 0)
            {
                var firstLine         = Get(0);
                var existingNrOfLines = Math.Min(nrOfLines, firstLine.LineIndex);
                var range1            = new ScreenBufferLinesRange
                {
                    Lines = Enumerable.Range(firstLine.LineIndex - existingNrOfLines, existingNrOfLines)
                            .Select(ln => new DisplayLine(firstLine.Message, ln, firstLine.TotalLinesInMessage, displayTextGetter, source)).ToList(),
                    BeginPosition = firstLine.Message.Position,
                    EndPosition   = BeginPosition
                };
                Prepend(range1);
                nrOfLines -= existingNrOfLines;
            }
            if (nrOfLines > 0)
            {
                var range2 = await GetScreenBufferLines(Source, BeginPosition, nrOfLines,
                                                        EnumMessagesFlag.Backward, displayTextGetter, diagnostics, cancellation);

                Prepend(range2);
            }
        }
示例#4
0
        public async Task LoadAfter(int nrOfLines, CancellationToken cancellation)
        {
            if (Count > 0)
            {
                var lastLine          = Get(Count - 1);
                var existingNrOfLines = Math.Min(nrOfLines, lastLine.TotalLinesInMessage - lastLine.LineIndex - 1);
                var range1            = new ScreenBufferLinesRange
                {
                    Lines = Enumerable.Range(lastLine.LineIndex + 1, existingNrOfLines).Select(ln => new DisplayLine(
                                                                                                   lastLine.Message, ln, lastLine.TotalLinesInMessage, displayTextGetter, source)).ToList(),
                    BeginPosition = EndPosition,
                    EndPosition   = lastLine.Message.EndPosition
                };
                Append(range1);
                nrOfLines -= existingNrOfLines;
            }
            if (nrOfLines > 0)
            {
                var range2 = await GetScreenBufferLines(Source, EndPosition, nrOfLines,
                                                        EnumMessagesFlag.Forward, displayTextGetter, diagnostics, cancellation);

                Append(range2);
            }
        }