Mono.TextEditor.TextEditorData.GetChunks C# (CSharp) Method

GetChunks() public method

public GetChunks ( Mono.TextEditor.DocumentLine line, int offset, int length ) : IEnumerable
line Mono.TextEditor.DocumentLine
offset int
length int
return IEnumerable
		public IEnumerable<Chunk> GetChunks (DocumentLine line, int offset, int length)
		{
			return document.SyntaxMode.GetChunks (ColorStyle, line, offset, length);
		}		
	

Usage Example

Example #1
0
        // for markup syntax mode the syntax highlighting information need to be taken into account
        // when calculating the selection offsets.
        static int PosToOffset(TextEditorData data, DocumentLocation loc)
        {
            DocumentLine line = data.GetLine(loc.Line);

            if (line == null)
            {
                return(0);
            }
            var startChunk = data.GetChunks(line, line.Offset, line.LengthIncludingDelimiter);
            int col        = 1;

            foreach (var chunk in startChunk)
            {
                if (col <= loc.Column && loc.Column < col + chunk.Length)
                {
                    return(chunk.Offset - col + loc.Column);
                }
                col += chunk.Length;
            }
            return(line.Offset + line.Length);
        }
All Usage Examples Of Mono.TextEditor.TextEditorData::GetChunks