Partilhar via


ITextEdit Interface

Definition

Represents a set of editing operations on an ITextBuffer. The positions of all edit operations are specified with respect to the state of the ITextBuffer at the time this object was created.

public interface class ITextEdit : IDisposable, Microsoft::VisualStudio::Text::ITextBufferEdit
public interface ITextEdit : IDisposable, Microsoft.VisualStudio.Text.ITextBufferEdit
type ITextEdit = interface
    interface ITextBufferEdit
    interface IDisposable
Public Interface ITextEdit
Implements IDisposable, ITextBufferEdit
Implements

Remarks

At most one ITextBufferEdit object may be active at a given time for a particular ITextBuffer. This object is considered active as long as it has been neither Applied nor Cancelled; calling Dispose on an unapplied object is equivalent to calling Cancel.

The operations performed using this object are not reflected in the ITextBuffer until the Apply() method has been called.

Properties

Canceled

Determines whether this edit has been canceled.

(Inherited from ITextBufferEdit)
HasEffectiveChanges

Determines whether the edit has changes in non-read-only regions.

HasFailedChanges

Determines whether any changes failed to be added to this edit due to read-only regions.

Snapshot

A snapshot of the ITextBuffer at the time this ITextBufferEdit object was created.

(Inherited from ITextBufferEdit)

Methods

Apply()

Commits all the modifications made with this ITextBufferEdit object to the underlying ITextBuffer. Depending on the type of edit, it may also cause the ITextBuffer to generate a new snapshot and raise its Changed event if any modifications were made. This method may be called only once. After it is called, any other calls on this object (other than Dispose) will result in an InvalidOperationException.

(Inherited from ITextBufferEdit)
Cancel()

Abandons all modifications started using this ITextBufferEdit object. Any further calls on this object will result in an InvalidOperationException.

(Inherited from ITextBufferEdit)
Delete(Int32, Int32)

Deletes a equence of characters from the buffer.

Delete(Span)

Deletes a sequence of characters from the buffer.

Insert(Int32, Char[], Int32, Int32)

Inserts an array of characters at the specified position in the ITextBuffer.

Insert(Int32, String)

Inserts the given text at the specified positionin the text buffer.

Replace(Int32, Int32, String)

Replaces a sequence of characters with different text. This method has the same effect as first deleting the charsToReplace and then inserting replaceWith.

Replace(Span, String)

Replaces a sequence of characters with different text. This method has the same effect as first deleting the characters in replaceSpan and then inserting replaceWith.

Applies to