Class
TextDocument

Represents a text document.

Definition

Namespace:Telerik.Windows.SyntaxEditor.Core.Text

Assembly:Telerik.Windows.SyntaxEditor.Core.dll

Syntax:

cs-api-definition
public class TextDocument

Inheritance: objectTextDocument

Constructors

TextDocument()

Initializes a new instance of the TextDocument class.

Declaration

cs-api-definition
public TextDocument()

TextDocument(TextDocument)

Initializes a new instance of the TextDocument class.

Declaration

cs-api-definition
public TextDocument(TextDocument document)

Parameters

document

TextDocument

TextDocument(TextReader)

Initializes a new instance of the TextDocument class.

Declaration

cs-api-definition
public TextDocument(TextReader textReader)

Parameters

textReader

TextReader

TextDocument(string)

Initializes a new instance of the TextDocument class.

Declaration

cs-api-definition
public TextDocument(string text)

Parameters

text

string

Properties

CurrentSnapshot

Gets the current snapshot.

Declaration

cs-api-definition
public TextSnapshot CurrentSnapshot { get; }

Property Value

TextSnapshot

History

Gets the document history.

Declaration

cs-api-definition
public TextDocumentHistory History { get; }

Property Value

TextDocumentHistory

Methods

Delete(Span)

Deletes the given span.

Declaration

cs-api-definition
public bool Delete(Span spanToDelete)

Parameters

spanToDelete

Span

Returns

bool

Find(string, int)

Looks up for a span containing the search text.

Declaration

cs-api-definition
public Span? Find(string searchText, int startIndex)

Parameters

searchText

string

startIndex

int

Returns

Span?

Find(string, int, bool)

Looks up for a span containing the search text.

Declaration

cs-api-definition
public Span? Find(string searchText, int startIndex, bool useRegularExpression)

Parameters

searchText

string

startIndex

int

useRegularExpression

bool

Returns

Span?

Find(string, int, bool, bool)

Looks up for a span containing the search text or matching a regex pattern.

Declaration

cs-api-definition
public Span? Find(string searchText, int startIndex, bool matchCase, bool useRegularExpression)

Parameters

searchText

string

startIndex

int

matchCase

bool

useRegularExpression

bool

Returns

Span?

Find(string, int, bool, bool, bool)

Looks up for a span containing the search text or matching a regex pattern.

Declaration

cs-api-definition
public Span? Find(string searchText, int startIndex, bool matchCase, bool useRegularExpression, bool matchWord)

Parameters

searchText

string

startIndex

int

matchCase

bool

useRegularExpression

bool

matchWord

bool

Returns

Span?

FindAll(string)

Looks up for a all spans containing the search text.

Declaration

cs-api-definition
public IEnumerable<Span> FindAll(string searchText)

Parameters

searchText

string

Returns

IEnumerable<Span>

FindAll(string, bool)

Looks up for a all spans containing the search text or matching a regex pattern.

Declaration

cs-api-definition
public IEnumerable<Span> FindAll(string searchText, bool useRegularExpression)

Parameters

searchText

string

useRegularExpression

bool

Returns

IEnumerable<Span>

FindAll(string, bool, bool, bool)

Looks up for a all spans containing the search text or matching a regex pattern.

Declaration

cs-api-definition
public IEnumerable<Span> FindAll(string searchText, bool matchCase, bool useRegularExpression, bool matchWord = false)

Parameters

searchText

string

matchCase

bool

useRegularExpression

bool

matchWord

bool

Returns

IEnumerable<Span>

FindPrevious(string, int, bool)

Looks up for a previous span containing the search text or matching a regex pattern.

Declaration

cs-api-definition
public Span? FindPrevious(string searchText, int startIndex, bool matchCase)

Parameters

searchText

string

startIndex

int

matchCase

bool

Returns

Span?

FindPrevious(string, int, bool, bool, bool)

Looks up for a previous span containing the search text or matching a regex pattern.

Declaration

cs-api-definition
public Span? FindPrevious(string searchText, int startIndex, bool matchCase, bool useRegularExpression, bool matchWord)

Parameters

searchText

string

startIndex

int

matchCase

bool

useRegularExpression

bool

matchWord

bool

Returns

Span?

Insert(int, string)

Inserts text at the given position.

Declaration

cs-api-definition
public bool Insert(int position, string text)

Parameters

position

int

text

string

Returns

bool

OnPreviewTextContentChanged(TextContentChangedEventArgs)

Raises the PreviewTextContentChanged event.

Declaration

cs-api-definition
protected virtual void OnPreviewTextContentChanged(TextContentChangedEventArgs args)

Parameters

args

TextContentChangedEventArgs

OnPreviewTextContentChanging(TextContentChangingEventArgs)

Raises the PreviewTextContentChanging event.

Declaration

cs-api-definition
protected virtual void OnPreviewTextContentChanging(TextContentChangingEventArgs args)

Parameters

args

TextContentChangingEventArgs

OnTextContentChanged(TextContentChangedEventArgs)

Raises the TextContentChanged event.

Declaration

cs-api-definition
protected virtual void OnTextContentChanged(TextContentChangedEventArgs args)

Parameters

args

TextContentChangedEventArgs

OnTextContentChanging(TextContentChangingEventArgs)

Raises the TextContentChanging event.

Declaration

cs-api-definition
protected virtual void OnTextContentChanging(TextContentChangingEventArgs args)

Parameters

args

TextContentChangingEventArgs

Replace(Span, string)

Replaces the given span with the given replace text.

Declaration

cs-api-definition
public bool Replace(Span spanToReplace, string replaceText)

Parameters

spanToReplace

Span

replaceText

string

Returns

bool

ReplaceAllMatches(string, string, bool, bool, bool)

Replaces all matched strings of the given search text with the provided replace text.

Declaration

cs-api-definition
public int ReplaceAllMatches(string searchText, string replaceText, bool matchCase, bool useRegularExpression, bool matchWord = false)

Parameters

searchText

string

replaceText

string

matchCase

bool

useRegularExpression

bool

matchWord

bool

Returns

int

ReplaceNextMatch(string, int, string, bool, bool)

Replaces the next matched strings of the given search text with the provided replace text.

Declaration

cs-api-definition
public bool ReplaceNextMatch(string searchText, int startIndex, string replaceText, bool matchCase, bool useRegularExpression)

Parameters

searchText

string

startIndex

int

replaceText

string

matchCase

bool

useRegularExpression

bool

Returns

bool

Events

PreviewTextContentChanged

Occurs when text is about to be changed.

Declaration

cs-api-definition
public event EventHandler<TextContentChangedEventArgs> PreviewTextContentChanged

Event Value

EventHandler<TextContentChangedEventArgs>

PreviewTextContentChanging

Occurs when text is about to be changing.

Declaration

cs-api-definition
public event EventHandler<TextContentChangingEventArgs> PreviewTextContentChanging

Event Value

EventHandler<TextContentChangingEventArgs>

TextContentChanged

Occurs when text is changed.

Declaration

cs-api-definition
public event EventHandler<TextContentChangedEventArgs> TextContentChanged

Event Value

EventHandler<TextContentChangedEventArgs>

TextContentChanging

Occurs when text is changing.

Declaration

cs-api-definition
public event EventHandler<TextContentChangingEventArgs> TextContentChanging

Event Value

EventHandler<TextContentChangingEventArgs>