Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ILineBreaks.cs « Storage « TextModel « Impl « Text « src - github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2100860914948372dd8886ae3b913405d496b1d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.Text.Utilities;

namespace Microsoft.VisualStudio.Text.Implementation
{
    /// <summary>
    /// Information about the line breaks contained in an <see cref="StringRebuilderForChars"/>.
    /// </summary>
    public interface ILineBreaks
    {
        /// <summary>
        /// The number of line breaks in the <see cref="StringRebuilderForChars"/>.
        /// </summary>
        int Length { get; }

        /// <summary>
        /// The starting position of the <paramref name="index"/>th line break.
        /// </summary>
        int StartOfLineBreak(int index);

        /// <summary>
        /// The starting position of the <paramref name="index"/>th line break.
        /// </summary>
        int EndOfLineBreak(int index);
    }

    public interface ILineBreaksEditor : ILineBreaks
    {
        /// <summary>
        /// Add a line break at <paramref name="start"/> with <paramref name="length"/>
        /// </summary>
        void Add(int start, int length);
    }

    public interface IPooledLineBreaksEditor : ILineBreaksEditor
    {
        /// <summary>
        ///  If the internal list of line breaks has excess capacity, copy it to a correctly sized list and return the oversized
        ///  list to a pool that can be reused.
        /// </summary>
        /// <remarks>
        /// This method should be called when using calling <see cref="LineBreakManager.CreatePooledLineBreakEditor(int)"/>.
        /// </remarks>
        void ReleasePooledLineBreaks();
    }
}