IEditorView Interface
Provides the base requirements for a text view that supports editing and is presented in a SyntaxEditor.
public interface IEditorView : ITextView
Properties
ContainsFocus
Indicates whether the view currently has or contains keyboard focus.
bool ContainsFocus { get; }
Property Value
- bool:
trueif the view currently has or contains keyboard focus; otherwise,false.
Remarks
A view can contain focus if a nested control such as an adornment or search overlay pane has focus.
CurrentSnapshotLine
The current ITextSnapshotLine that the primary caret appears on within the view.
CurrentViewLine
The current ITextViewLine that the primary caret appears on within the view.
HasFocus
Indicates whether the view currently has keyboard focus.
bool HasFocus { get; }
Property Value
- bool:
trueif the view currently has keyboard focus; otherwise,false.
HighlightedResultSearchOptions
The ISearchOptions to use for searching when highlighting search results.
ISearchOptions? HighlightedResultSearchOptions { get; set; }
Property Value
Remarks
Highlighted results are displayed when using incremental search and the IsSearchResultHighlightingEnabled property is set to true.
This property can also be manually set when using a search pane as the user types, so that results will be immediately displayed.
Set the property to null to stop highlighting.
IntelliPrompt
The IEditorViewIntelliPrompt to use for requesting IntelliPrompt within the view.
IsActive
Indicates whether the view is the currently-active view in the editor.
bool IsActive { get; }
Property Value
- bool:
trueif the view is the currently-active view in the editor; otherwise,false.
Remarks
The currently-active view in the editor is the view that contains focus when focus is moved within the editor. There is always a single view in an editor marked as active. Use the HasFocus property to determine if the view currently has keyboard focus.
IsIncrementalSearchActive
Indicates whether incremental searching is active.
bool IsIncrementalSearchActive { get; set; }
Property Value
- bool:
trueif incremental searching is active; otherwise,false.
Margins
The collection of margins that are currently in the view.
OverlayPanes
The collection of IOverlayPane instances that are open in the view.
IEditorViewOverlayPaneCollection OverlayPanes { get; }
Property Value
Placement
An EditorViewPlacement indicating the location of the view.
PositionFinder
The ITextPositionFinder that can be used to find TextPosition objects relative to another specified TextPosition.
Scroller
The IEditorViewScroller to use for scrolling the view.
Searcher
The IEditorViewSearcher that is used to perform find/replace and other search-related operations on the view.
SelectedText
The text of the current primary selection range in the view.
Selection
An IEditorViewSelection that manages the selection within the view.
TextChangeActions
The IEditorViewTextChangeActions that is used to perform text change actions in the view.
Methods
Activate()
Activates this view.
void Activate()
Remarks
The currently-active view in the editor is the view that contains focus when focus is moved within the editor. There is always a single view in an editor marked as active.
CopyAndAppendToClipboard()
Copies the currently selected text and appends it to the existing text on the clipboard.
void CopyAndAppendToClipboard()
CopyToClipboard()
Copies the currently selected text to the clipboard.
void CopyToClipboard()
CutAndAppendToClipboard()
Cuts the currently selected text and appends it to the existing text on the clipboard.
void CutAndAppendToClipboard()
CutLineToClipboard()
Cuts the currently active view line to the clipboard.
void CutLineToClipboard()
CutToClipboard()
Cuts the currently selected text to the clipboard.
void CutToClipboard()
DeleteSelectedText(ITextChangeType, IEditorViewTextChangeOptions?)
Performs a delete text change by deleting the view's selected text ranges.
bool DeleteSelectedText(ITextChangeType type, IEditorViewTextChangeOptions? options = null)
| Parameter | Type | Description |
|---|---|---|
| type | ITextChangeType | An ITextChangeType specifying the type of change. |
| options | IEditorViewTextChangeOptions | The optional IEditorViewTextChangeOptions for the change. |
Returns
- bool:
trueif a text change was allowed to occur; otherwise,false.
ExecuteEditAction(IEditAction)
Executes the specified IEditAction within the view and records the action within a macro when appropriate.
bool ExecuteEditAction(IEditAction action)
| Parameter | Type | Description |
|---|---|---|
| action | IEditAction | The IEditAction to execute. |
Returns
- bool:
trueif the action was able to execute; otherwise,false.
ExportSelectedText(ITextExporter)
Exports the selected text to another text format, such as HTML or RTF.
string ExportSelectedText(ITextExporter exporter)
| Parameter | Type | Description |
|---|---|---|
| exporter | ITextExporter | The ITextExporter to use for the export operation. |
Returns
- string:
The exported text.
FindCurrentWordEnd()
Returns the document offset of the word end character that occurs at or after the primary caret.
FindCurrentWordStart()
Returns the document offset of the word start character that occurs at or before the primary caret.
FindNextWordStart()
Returns the document offset of the word start character that occurs after the primary caret.
FindPreviousWordStart()
Returns the document offset of the word start character that occurs before the primary caret.
Focus()
Ensures the view has focus.
Focus(FocusState)
Ensures the view has focus.
bool Focus(FocusState state)
| Parameter | Type | Description |
|---|---|---|
| state | FocusState | A FocusState specifying the reason for focus to be set. |
Returns
- bool:
trueif focus was successfully set; otherwise,false.
GetCharacterBounds(TextPosition)
Returns the TextBounds for the specified TextPosition, relative to the text area's coordinates, if any.
TextBounds? GetCharacterBounds(TextPosition position)
| Parameter | Type | Description |
|---|---|---|
| position | TextPosition | The TextPosition whose bounds need to be retrieved. |
Returns
GetCharacterBounds(int, bool)
Returns the TextBounds for the specified offset, relative to the text area's coordinates, if any.
TextBounds? GetCharacterBounds(int offset, bool hasFarAffinity = false)
| Parameter | Type | Description |
|---|---|---|
| offset | int | The offset whose bounds need to be retrieved. |
| hasFarAffinity | bool | Whether the offset has affinity for the far side, which is used when the offset is where a view line is wrapped to a second view line.
The default value is |
Returns
GetCharacterColumn(TextPosition)
Returns the column index within the view for the specified TextPosition or 0 if the position is out of range.
int GetCharacterColumn(TextPosition position)
| Parameter | Type | Description |
|---|---|---|
| position | TextPosition | The TextPosition whose column index is being requested. |
Returns
GetCharacterColumn(int, bool)
Returns the column index within the view for the specified offset or 0 if the offset is out of range.
int GetCharacterColumn(int offset, bool hasFarAffinity = false)
| Parameter | Type | Description |
|---|---|---|
| offset | int | The offset whose column index is being requested. |
| hasFarAffinity | bool | Whether the offset has affinity for the far side, which is used when the offset is where a view line is wrapped to a second view line.
The default value is |
Returns
GetCharacterIndexRanges(TextPositionRange, int)
Returns the collection of character index Range objects for characters contained on each view line in the specified TextPositionRange.
IList<Range> GetCharacterIndexRanges(TextPositionRange positionRange, int minimumLines = 1)
| Parameter | Type | Description |
|---|---|---|
| positionRange | TextPositionRange | The TextPositionRange to examine. |
| minimumLines | int | The optional minimum number of lines to return, used for block selections.
For continuous stream selections, pass |
Returns
GetCurrentWordText()
Returns the text of the current word.
GetCurrentWordTextRange()
Returns the TextRange for the current word.
GetReader()
Returns an ITextSnapshotReader, initialized at the caret offset, that can be used to navigate through the text and token contents of the current snapshot.
GetTextStatisticsForSelectedText()
Returns the ITextStatistics for the selected text in the view, which provides numerous statistics about the text such as word, sentence, character counts as well as readability scores.
GetViewLine(double, LocationToPositionAlgorithm)
Returns the ITextViewLine that contains the specified Y location, if any.
ITextViewLine? GetViewLine(double verticalLocation, LocationToPositionAlgorithm algorithm)
| Parameter | Type | Description |
|---|---|---|
| verticalLocation | double | The Y location to examine, in text area-relative coordinates. |
| algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
GetVirtualCharacterFillString(TextPosition, bool)
Returns a string specifying the indentation (tabs and/or spaces) needed to fill a view line up to the specified TextPosition.
string GetVirtualCharacterFillString(TextPosition position, bool returnCharacterFill)
| Parameter | Type | Description |
|---|---|---|
| position | TextPosition | The TextPosition to be examined. |
| returnCharacterFill | bool | Whether to return a character fill in addition to line fill. |
Returns
Remarks
This method will return Empty if the character is not a virtual character.
InsertFile(string)
Inserts the text contents of the specified file into the view, replacing any selected text.
void InsertFile(string path)
| Parameter | Type | Description |
|---|---|---|
| path | string | The fully qualified path to the file that will be inserted. |
InsertSurroundingText(ITextChangeType, string?, string, bool)
Inserts text into the document that surrounds the currently selected text ranges in the view.
bool InsertSurroundingText(ITextChangeType type, string? preText, string postText, bool reselect = false)
| Parameter | Type | Description |
|---|---|---|
| type | ITextChangeType | An ITextChangeType specifying the type of change. |
| preText | string | The text to insert before the currently selected text ranges. |
| postText | string | The text to insert after the currently selected text ranges. |
| reselect | bool | Whether to reselect the inner text. |
Returns
- bool:
trueif a text change was allowed to occur; otherwise,false.
InsertSurroundingText(string?, string)
Inserts text into the document that surrounds the currently selected text ranges in the view, using a TextChangeTypes.TextReplacement change type.
bool InsertSurroundingText(string? preText, string postText)
| Parameter | Type | Description |
|---|---|---|
| preText | string | The text to insert before the currently selected text ranges. |
| postText | string | The text to insert after the currently selected text ranges. |
Returns
- bool:
trueif a text change was allowed to occur; otherwise,false.
IsVirtualCharacter(TextPosition, bool)
Returns whether the specified TextPosition is a virtual character (beyond line or document end).
bool IsVirtualCharacter(TextPosition position, bool lineTerminatorsAreVirtual)
| Parameter | Type | Description |
|---|---|---|
| position | TextPosition | The TextPosition to examine. |
| lineTerminatorsAreVirtual | bool | Indicates whether to treat line terminators as virtual characters. |
Returns
- bool:
trueif the specified TextPosition is a virtual character (beyond line or document end); otherwise,false.
IsVirtualLine(TextPosition)
Returns whether the specified TextPosition is a virtual line (beyond document end).
bool IsVirtualLine(TextPosition position)
| Parameter | Type | Description |
|---|---|---|
| position | TextPosition | The TextPosition to examine. |
Returns
- bool:
trueif the specified TextPosition is a virtual line (beyond document end); otherwise,false.
IsVirtualLine(int)
Returns whether the specified TextPosition line index is a virtual line (beyond document end).
bool IsVirtualLine(int positionLineIndex)
| Parameter | Type | Description |
|---|---|---|
| positionLineIndex | int | The TextPosition line index to examine. |
Returns
- bool:
trueif the specified TextPosition line index is a virtual line (beyond document end); otherwise,false.
LocationToPosition(Point, LocationToPositionAlgorithm)
Returns the TextPosition for the specified location.
TextPosition? LocationToPosition(Point location, LocationToPositionAlgorithm algorithm)
| Parameter | Type | Description |
|---|---|---|
| location | Point | A |
| algorithm | LocationToPositionAlgorithm | The LocationToPositionAlgorithm to use for calculation. |
Returns
Remarks
If using an absolute algorithm and no valid TextPosition is located, null will be returned.
PasteFromClipboard()
Pastes text from the clipboard into the selection.
void PasteFromClipboard()
ReplaceSelectedText(ITextChangeType, string?, IEditorViewTextChangeOptions?)
Performs a replace text change by overwriting the view's selected text ranges.
bool ReplaceSelectedText(ITextChangeType type, string? text, IEditorViewTextChangeOptions? options = null)
| Parameter | Type | Description |
|---|---|---|
| type | ITextChangeType | An ITextChangeType specifying the type of change. |
| text | string | The text to insert. |
| options | IEditorViewTextChangeOptions | The optional IEditorViewTextChangeOptions for the change. |
Returns
- bool:
trueif a text change was allowed to occur; otherwise,false.
StartPointerSelection(InputPointerButtonEventArgs)
Starts a pointer selection operation during a pointer button down event.
void StartPointerSelection(InputPointerButtonEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | InputPointerButtonEventArgs | A InputPointerButtonEventArgs that contains the event data. |
Remarks
The left or right pointer button must be pressed when this method is called. When the left button pointer selection starts, the pointer will be captured and further selection processing will be handled automatically.
Events
HasFocusChanged
Occurs when the HasFocus property value is changed.
HighlightedResultSearchOptionsChanged
Occurs when the HighlightedResultSearchOptions property value is changed.
SelectionChanged
Occurs after the selection is changed.
event EventHandler<EditorViewSelectionEventArgs> SelectionChanged
Event Type
Inherited Members
- ITextView.CreateTagAggregator<T>()
- ITextView.GetAdornmentLayer(AdornmentLayerDefinition)
- ITextView.GetViewLine(int, bool)
- ITextView.GetViewLine(TextPosition)
- ITextView.GetViewLine(ITextViewLine, int, bool)
- ITextView.InvalidateRender()
- ITextView.OffsetToPosition(int)
- ITextView.PerformLayout()
- ITextView.PositionToOffset(TextPosition)
- ITextView.TransformFromTextArea(Point)
- ITextView.TransformFromTextArea(Rectangle)
- ITextView.TransformToTextArea(Point)
- ITextView.TransformToTextArea(Rectangle)
- ITextView.CollapsedRegionManager
- ITextView.CurrentSnapshot
- ITextView.DefaultBackgroundColor
- ITextView.DefaultCharacterWidth
- ITextView.DefaultFontFamilyName
- ITextView.DefaultFontSize
- ITextView.DefaultForegroundColor
- ITextView.DefaultLineHeight
- ITextView.DefaultSpaceWidth
- ITextView.HighlightingStyleRegistry
- ITextView.IsDefaultBackgroundColorLight
- ITextView.IsWhitespaceVisible
- ITextView.Properties
- ITextView.ScrollState
- ITextView.SyntaxEditor
- ITextView.TextAreaPadding
- ITextView.TextAreaSize
- ITextView.TextAreaViewportBounds
- ITextView.UniqueId
- ITextView.VisibleViewLines
- ITextView.VisualElement
- ITextView.ZoomLevel
- ITextView.Closed
- ITextView.MarginsDestroyed
- ITextView.TextAreaLayout