IVsTextView Interface
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Manages the text view of an editor window and contains methods to manage the text view. The view is essentially the editor window shown in the user interface (UI).
public interface class IVsTextView
public interface class IVsTextView
__interface IVsTextView
[System.Runtime.InteropServices.ComConversionLoss]
[System.Runtime.InteropServices.Guid("BB23A14B-7C61-469A-9890-A95648CED5E6")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsTextView
[System.Runtime.InteropServices.ComConversionLoss]
[System.Runtime.InteropServices.Guid("BB23A14B-7C61-469A-9890-A95648CED5E6")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsTextView
[<System.Runtime.InteropServices.ComConversionLoss>]
[<System.Runtime.InteropServices.Guid("BB23A14B-7C61-469A-9890-A95648CED5E6")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsTextView = interface
[<System.Runtime.InteropServices.ComConversionLoss>]
[<System.Runtime.InteropServices.Guid("BB23A14B-7C61-469A-9890-A95648CED5E6")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsTextView = interface
Public Interface IVsTextView
- Derived
- Attributes
The IVsTextView interface is not the MDI child, but an individual window of text. If a splitter is involved, there can be multiple views in an MDI child. The term, caret, refers to the text insertion point, while the term, cursor, refers to the mouse pointer.
Precaución
This interface is not thread-safe. You should not call anything on this interface from anything but the main UI thread.
If you need to perform any operations on the view from a different thread, you may either:
Use the interface IVsThreadSafeTextView.
Call the GetWindowHandle method and use the
PostMessage
method to post messages to the main thread.
Some methods on IVsTextViewuse ViewCol coordinates (for example, GetTextStream and GetCaretPos), while others use CharIndex coordinates (for example, GetWordExtent). ViewCol coordinates may include virtual space while CharIndex coordinates are only an offset into a buffer line and never include virtual space.
If you get a coordinate in ViewCol coordinates, then you should only call methods that take CharIndex coordinates after making sure that the ViewCol coordinate does not lie in the virtual space region. For example, if you call the following:
long iLine;
long cCount;
ViewCol iCol;
IVsTextView::SomeMethod(&iLine, &icol);
Then you must check to be sure that the following is true:
IVsTextBuffer::GetLengthOfLine(iLine, &cCount);
iCol < cCount
Then call the following:
IVsTextView::SomeOtherMethod(ViewCol(iCol ))
// where SomeOtherMethod takes ViewCol coordinates
See illustrations of the implementation and/or calling of this interface in the sample Figures Language Service.
Called by clients who want to manage their view.
Add |
Adds a command filter to the existing chain of command filters. |
Center |
Places the specified column of text in the center of the view. |
Center |
Places the specified lines of text in the center of the view. |
Clear |
Clears the current selection. |
Close |
Closes and unregisters a view with the view manager. |
Ensure |
Ensures that text is in view, both vertically and horizontally. |
Get |
Returns the current contents of the text buffer. |
Get |
Returns the line and column index of the cursor position. |
Get |
Converts a text stream position to a line and column index. |
Get |
Returns the pixel height of a line. |
Get |
Converts a line and column index to a text stream position. |
Get |
Returns the coordinates for the upper left corner of a particular line and column. |
Get |
Returns the core text editor's scroll bar settings for the specified scroll bar. |
Get |
Returns a copy of the selected text. |
Get |
Returns the text span corresponding to the current selection, if there is one. |
Get |
Returns a copy of the selected text in IDataObject interface format. |
Get |
Returns the current selection mode. |
Get |
Returns the text span associated with a selection. |
Get |
Returns a specified stream of text in a string. |
Get |
Returns the window handle for this view. |
Get |
Returns the current word extent. |
Highlight |
Highlights the matching brace in a language construct. |
Initialize(IVs |
Creates the view and allows clients to specify one or more TextViewInitFlags options. |
Position |
Puts the caret in a position suitable for editing a function. |
Remove |
Removes a command filter from the chain of command filters. |
Replace |
Replaces line text. |
Restrict |
Reduces the view’s range of visible/editable lines to a subset of the buffer’s lines. |
Send |
Sends explicit focus to the window. |
Set |
Associates a text buffer with the view. |
Set |
Sets the coordinates of the end point of a selection. |
Set |
Sets the core text editor's scroll bar settings for the specified scroll bar. |
Set |
Selects specified text. |
Set |
Sets the selection mode. |
Set |
Sets the top line in the view to the baseline. |
Update |
Used for word completion control. |
Update |
Updates the tip window. |
Update |
Forces the view to update its frame window caption, such as "[Read only]". |