Пример #1
0
        public Span GetSpan(Line line, string style)
        {
            var lineNumber = line.Number;

            if (Start == End) return null;
            if (lineNumber < Start.Line) return null;
            if (lineNumber > End.Line) return null;

            var columnStart = (lineNumber == Start.Line) ? Start.Column : 0;
            var columnEnd = (lineNumber == End.Line) ? End.Column : line.Text.Length;

            var selection = new Span(columnStart, columnEnd - columnStart,
                style);

            return selection;
        }
Пример #2
0
        public void PaintLine(Line line, Gutter.Gutter gutter, int firstColumn, Document doc)
        {
            var x = 0;
            var offset = gutter.Width - (firstColumn * geometry.CharWidth);
            var spans = doc.ApplySelectionSpan(line.Spans, line);

            foreach (var span in SplitSpansForRendering(spans))
            {
                if (span.renderCache == null)
                    span.renderCache = new RenderCache(span, geometry, line, x);

                if (offset + span.renderCache.Width >= 0)
                    PaintSpan(span, offset);

                offset += span.renderCache.Width;
                x += span.renderCache.Text.Length;

                if (offset > g.ClipBounds.Right) break;
            }
        }