2
// <copyright see="prj:///doc/copyright.txt"/>
3
// <license see="prj:///doc/license.txt"/>
4
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
5
// <version value="$version"/>
10
using System.Diagnostics;
12
namespace MonoDevelop.TextEditor.Document
15
public enum TextWordType {
22
/// This class represents single words with color information, two special versions of a word are
35
static TextWord spaceWord = new TextWord(TextWordType.Space);
36
static TextWord tabWord = new TextWord(TextWordType.Tab);
38
public bool hasDefaultColor;
40
static public TextWord Space {
46
static public TextWord Tab {
54
if (type == TextWordType.Word) {
61
public bool HasDefaultColor {
63
return hasDefaultColor;
67
public TextWordType Type {
73
// string myword = null;
76
return document.GetText(word.Offset + offset, length);
77
// if (myword == null) {
78
// myword = document.GetText(word.Offset + offset, length);
84
public Pango.FontDescription Font {
96
public HighlightColor SyntaxColor {
105
public bool IsWhiteSpace {
107
return type == TextWordType.Space || type == TextWordType.Tab;
112
private TextWord(TextWordType type)
117
public TextWord(IDocument document, LineSegment word, int offset, int length, HighlightColor color, bool hasDefaultColor)
119
Debug.Assert(document != null);
120
Debug.Assert(word != null);
121
Debug.Assert(color != null);
123
this.document = document;
125
this.offset = offset;
126
this.length = length;
128
this.hasDefaultColor = hasDefaultColor;
129
this.type = TextWordType.Word;
133
/// Converts a <see cref="TextWord"/> instance to string (for debug purposes)
135
public override string ToString()
137
return "[TextWord: Word = " + Word + ", Font = " + Font.Family + ", Color = " + Color + "]";