public void DoHighlighting(ProjectV2.ProjectNode project) { m_highlighting = true; m_textView.TextStorage.RemoveAttributeRange(NSAttributedString.NSForegroundColorAttributeName, new NSRange(0, m_textView.String.Length)); m_textView.TextStorage.RemoveAttributeRange(NSAttributedString.NSBackgroundColorAttributeName, new NSRange(0, m_textView.String.Length)); foreach (Token tok in project.Serializer.Tokens) { if (Colors.ContainsKey(tok.Type)) { m_textView.TextStorage.AddAttributeValueRange(NSAttributedString.NSForegroundColorAttributeName, Colors[tok.Type], new NSRange((uint)tok.Offset, (uint)tok.Length)); } if (BGColors.ContainsKey(tok.Type)) { m_textView.TextStorage.AddAttributeValueRange(NSAttributedString.NSBackgroundColorAttributeName, BGColors[tok.Type], new NSRange((uint)tok.Offset, (uint)tok.Length)); } } m_highlighting = false; }
public void OnDocumentChanged(object sender, string newText, ProjectV2.IProjectNode project) { m_textView.String = new NSString(newText); }