Class TextDocument
Represents a text document.
Inheritance
Namespace: Telerik.Windows.SyntaxEditor.Core.Text
Assembly: Telerik.Windows.SyntaxEditor.Core.dll
Syntax
public class TextDocument : Object
Constructors
TextDocument()
TextDocument(TextReader)
Initializes a new instance of the TextDocument class.
Declaration
public TextDocument(TextReader textReader)
Parameters
System.IO.TextReader
textReader
|
TextDocument(String)
Initializes a new instance of the TextDocument class.
Declaration
public TextDocument(string text)
Parameters
System.String
text
|
TextDocument(TextDocument)
Initializes a new instance of the TextDocument class.
Declaration
public TextDocument(TextDocument document)
Parameters
TextDocument
document
|
Properties
CurrentSnapshot
Gets the current snapshot.
Declaration
public TextSnapshot CurrentSnapshot { get; }
Property Value
TextSnapshot
|
History
Gets the document history.
Declaration
public TextDocumentHistory History { get; }
Property Value
TextDocumentHistory
|
Methods
Delete(Span)
Deletes the given span.
Declaration
public bool Delete(Span spanToDelete)
Parameters
Span
spanToDelete
|
Returns
System.Boolean
|
Find(String, Int32)
Looks up for a span containing the search text.
Declaration
public Nullable<Span> Find(string searchText, int startIndex)
Parameters
System.String
searchText
|
System.Int32
startIndex
|
Returns
System.Nullable<Span>
|
Find(String, Int32, Boolean)
Looks up for a span containing the search text.
Declaration
public Nullable<Span> Find(string searchText, int startIndex, bool useRegularExpression)
Parameters
System.String
searchText
|
System.Int32
startIndex
|
System.Boolean
useRegularExpression
|
Returns
System.Nullable<Span>
|
Find(String, Int32, Boolean, Boolean)
Looks up for a span containing the search text or matching a regex pattern.
Declaration
public Nullable<Span> Find(string searchText, int startIndex, bool matchCase, bool useRegularExpression)
Parameters
System.String
searchText
|
System.Int32
startIndex
|
System.Boolean
matchCase
|
System.Boolean
useRegularExpression
|
Returns
System.Nullable<Span>
|
Find(String, Int32, Boolean, Boolean, Boolean)
Looks up for a span containing the search text or matching a regex pattern.
Declaration
public Nullable<Span> Find(string searchText, int startIndex, bool matchCase, bool useRegularExpression, bool matchWord)
Parameters
System.String
searchText
|
System.Int32
startIndex
|
System.Boolean
matchCase
|
System.Boolean
useRegularExpression
|
System.Boolean
matchWord
|
Returns
System.Nullable<Span>
|
FindAll(String)
Looks up for a all spans containing the search text.
Declaration
public IEnumerable<Span> FindAll(string searchText)
Parameters
System.String
searchText
|
Returns
System.Collections.Generic.IEnumerable<Span>
|
FindAll(String, Boolean)
Looks up for a all spans containing the search text or matching a regex pattern.
Declaration
public IEnumerable<Span> FindAll(string searchText, bool useRegularExpression)
Parameters
System.String
searchText
|
System.Boolean
useRegularExpression
|
Returns
System.Collections.Generic.IEnumerable<Span>
|
FindAll(String, Boolean, Boolean, Boolean)
Looks up for a all spans containing the search text or matching a regex pattern.
Declaration
public IEnumerable<Span> FindAll(string searchText, bool matchCase, bool useRegularExpression, bool matchWord = false)
Parameters
System.String
searchText
|
System.Boolean
matchCase
|
System.Boolean
useRegularExpression
|
System.Boolean
matchWord
|
Returns
System.Collections.Generic.IEnumerable<Span>
|
FindPrevious(String, Int32, Boolean)
Looks up for a previous span containing the search text or matching a regex pattern.
Declaration
public Nullable<Span> FindPrevious(string searchText, int startIndex, bool matchCase)
Parameters
System.String
searchText
|
System.Int32
startIndex
|
System.Boolean
matchCase
|
Returns
System.Nullable<Span>
|
FindPrevious(String, Int32, Boolean, Boolean, Boolean)
Looks up for a previous span containing the search text or matching a regex pattern.
Declaration
public Nullable<Span> FindPrevious(string searchText, int startIndex, bool matchCase, bool useRegularExpression, bool matchWord)
Parameters
System.String
searchText
|
System.Int32
startIndex
|
System.Boolean
matchCase
|
System.Boolean
useRegularExpression
|
System.Boolean
matchWord
|
Returns
System.Nullable<Span>
|
Insert(Int32, String)
Inserts text at the given position.
Declaration
public bool Insert(int position, string text)
Parameters
System.Int32
position
|
System.String
text
|
Returns
System.Boolean
|
OnPreviewTextContentChanged(TextContentChangedEventArgs)
Raises the PreviewTextContentChanged event.
Declaration
protected virtual void OnPreviewTextContentChanged(TextContentChangedEventArgs args)
Parameters
TextContentChangedEventArgs
args
|
OnPreviewTextContentChanging(TextContentChangingEventArgs)
Raises the PreviewTextContentChanging event.
Declaration
protected virtual void OnPreviewTextContentChanging(TextContentChangingEventArgs args)
Parameters
TextContentChangingEventArgs
args
|
OnTextContentChanged(TextContentChangedEventArgs)
Raises the TextContentChanged event.
Declaration
protected virtual void OnTextContentChanged(TextContentChangedEventArgs args)
Parameters
TextContentChangedEventArgs
args
|
OnTextContentChanging(TextContentChangingEventArgs)
Raises the TextContentChanging event.
Declaration
protected virtual void OnTextContentChanging(TextContentChangingEventArgs args)
Parameters
TextContentChangingEventArgs
args
|
Replace(Span, String)
Replaces the given span with the given replace text.
Declaration
public bool Replace(Span spanToReplace, string replaceText)
Parameters
Span
spanToReplace
|
System.String
replaceText
|
Returns
System.Boolean
|
ReplaceAllMatches(String, String, Boolean, Boolean, Boolean)
Replaces all matched strings of the given search text with the provided replace text.
Declaration
public int ReplaceAllMatches(string searchText, string replaceText, bool matchCase, bool useRegularExpression, bool matchWord = false)
Parameters
System.String
searchText
|
System.String
replaceText
|
System.Boolean
matchCase
|
System.Boolean
useRegularExpression
|
System.Boolean
matchWord
|
Returns
System.Int32
|
ReplaceNextMatch(String, Int32, String, Boolean, Boolean)
Replaces the next matched strings of the given search text with the provided replace text.
Declaration
public bool ReplaceNextMatch(string searchText, int startIndex, string replaceText, bool matchCase, bool useRegularExpression)
Parameters
System.String
searchText
|
System.Int32
startIndex
|
System.String
replaceText
|
System.Boolean
matchCase
|
System.Boolean
useRegularExpression
|
Returns
System.Boolean
|
Events
PreviewTextContentChanged
Occurs when text is about to be changed.
Declaration
public event EventHandler<TextContentChangedEventArgs> PreviewTextContentChanged
Event Type
System.EventHandler<TextContentChangedEventArgs>
|
PreviewTextContentChanging
Occurs when text is about to be changing.
Declaration
public event EventHandler<TextContentChangingEventArgs> PreviewTextContentChanging
Event Type
System.EventHandler<TextContentChangingEventArgs>
|
TextContentChanged
Occurs when text is changed.
Declaration
public event EventHandler<TextContentChangedEventArgs> TextContentChanged
Event Type
System.EventHandler<TextContentChangedEventArgs>
|
TextContentChanging
Occurs when text is changing.
Declaration
public event EventHandler<TextContentChangingEventArgs> TextContentChanging
Event Type
System.EventHandler<TextContentChangingEventArgs>
|