Partager via


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)

Syntax

'Declaration
Public Interface ITextBuffer _
    Inherits IPropertyOwner
public interface ITextBuffer : IPropertyOwner
public interface class ITextBuffer : IPropertyOwner
type ITextBuffer =  
    interface 
        interface IPropertyOwner 
    end
public interface ITextBuffer extends IPropertyOwner

The ITextBuffer type exposes the following members.

Properties

  Name Description
Public property ContentType Gets the content type of the text in the buffer.
Public property CurrentSnapshot Gets the current content of the buffer.
Public property EditInProgress Determines whether an edit operation is currently in progress on the ITextBuffer.
Public property Properties Gets the collection of properties controlled by the property owner. (Inherited from IPropertyOwner.)

Top

Methods

  Name Description
Public method ChangeContentType Changes the IContentType for this ITextBuffer.
Public method CheckEditAccess Determines whether edit operations on this text buffer are permitted on the calling thread.
Public method CreateEdit() Creates an ITextEdit object that handles compound edit operations on this buffer.
Public method CreateEdit(EditOptions, Nullable<Int32>, Object) Creates an ITextEdit object that handles compound edit operations on this buffer.
Public method CreateReadOnlyRegionEdit Creates an IReadOnlyRegionEdit object that handles adding or removing read-only regions from this buffer.
Public method Delete Deletes a sequence of characters from the buffer.
Public method GetReadOnlyExtents Gets a list of read-only regions that overlap the given span.
Public method Insert Inserts the given text at the specified position in the ITextBuffer.
Public method IsReadOnly(Int32) Determines whether a text insertion would be prohibited at the specified position due to an IReadOnlyRegion.
Public method IsReadOnly(Span) Determines whether a text modification or deletion would be prohibited at span due to an IReadOnlyRegion.
Public method IsReadOnly(Int32, Boolean) Determines whether a text insertion would be prohibited at the specified position due to an IReadOnlyRegion.
Public method IsReadOnly(Span, Boolean) Determines whether a text modification or deletion would be prohibited at span due to an IReadOnlyRegion.
Public method Replace Replaces 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 method TakeThreadOwnership Claims 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

Events

  Name Description
Public event Changed Occurs when a non-empty ITextEdit is successfully applied.
Public event ChangedHighPriority Occurs when a non-empty ITextEdit is successfully applied.
Public event ChangedLowPriority Occurs when a non-empty ITextEdit is successfully applied.
Public event Changing Occurs just before a non-empty ITextEdit is applied.
Public event ContentTypeChanged Occurs whenever the IContentType has been changed.
Public event PostChanged Occurs after the Changed event and any resulting edits.
Public event ReadOnlyRegionsChanged Occurs when a IReadOnlyRegionEdit has created or removed read-only regions.

Top

Remarks

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.

See Also

Reference

Microsoft.VisualStudio.Text Namespace