ITextBuffer Interface

A mutable sequence of Unicode (UTF-16) characters.

Namespace:  Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

public interface ITextBuffer : IPropertyOwner

The ITextBuffer type exposes the following members.

  NameDescription
Public propertyContentTypeGets the content type of the text in the buffer.
Public propertyCurrentSnapshotGets the current content of the buffer.
Public propertyEditInProgressDetermines whether an edit operation is currently in progress on the ITextBuffer.
Public propertyPropertiesGets the collection of properties controlled by the property owner. (Inherited from IPropertyOwner.)
Top

  NameDescription
Public methodChangeContentTypeChanges the IContentType for this ITextBuffer.
Public methodCheckEditAccessDetermines whether edit operations on this text buffer are permitted on the calling thread.
Public methodCreateEdit()Creates an ITextEdit object that handles compound edit operations on this buffer.
Public methodCreateEdit(EditOptions, Nullable<Int32>, Object)Creates an ITextEdit object that handles compound edit operations on this buffer.
Public methodCreateReadOnlyRegionEditCreates an IReadOnlyRegionEdit object that handles adding or removing read-only regions from this buffer.
Public methodDeleteDeletes a sequence of characters from the buffer.
Public methodGetReadOnlyExtentsGets a list of read-only regions that overlap the given span.
Public methodInsertInserts the given text at the specified position in the ITextBuffer.
Public methodIsReadOnly(Int32)Determines whether a text insertion would be prohibited at the specified position due to an IReadOnlyRegion.
Public methodIsReadOnly(Span)Determines whether a text modification or deletion would be prohibited at span due to an IReadOnlyRegion.
Public methodIsReadOnly(Int32, Boolean)Determines whether a text insertion would be prohibited at the specified position due to an IReadOnlyRegion.
Public methodIsReadOnly(Span, Boolean)Determines whether a text modification or deletion would be prohibited at span due to an IReadOnlyRegion.
Public methodReplaceReplaces a sequence of characters with different text. This is equivalent to first deleting the text to be replaced and then inserting the new text.
Public methodTakeThreadOwnershipClaims ownership of this buffer for the current thread. All subsequent modifications of this ITextBuffer must be made from the current thread, or else an InvalidOperationException will be raised.
Top

  NameDescription
Public eventChangedOccurs when a non-empty ITextEdit is successfully applied.
Public eventChangedHighPriorityOccurs when a non-empty ITextEdit is successfully applied.
Public eventChangedLowPriorityOccurs when a non-empty ITextEdit is successfully applied.
Public eventChangingOccurs just before a non-empty ITextEdit is applied.
Public eventContentTypeChangedOccurs whenever the IContentType has been changed.
Public eventPostChangedOccurs after the Changed event and any resulting edits.
Public eventReadOnlyRegionsChangedOccurs when a IReadOnlyRegionEdit has created or removed read-only regions.
Top

For more information about text buffers, see the section "A Closer Look at the Text Model and the Text View" in Inside the Editor.

Positions in this buffer are treated as a sequence of characters (starting at character zero), or as a sequence of lines (starting at line zero). An empty buffer has a single line containing no characters.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft